<!DOCTYPE html><html lang="zh-CN" data-theme="dark"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"><title>从0制作自主空中机器人-5-Airsim-PX4仿真环境搭建 | MGodmonkeyの世界</title><meta name="keywords" content="ros,无人机,仿真"><meta name="author" content="MGodmonkey"><meta name="copyright" content="MGodmonkey"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#18171d"><meta name="mobile-web-app-capable" content="yes"><meta name="apple-touch-fullscreen" content="yes"><meta name="apple-mobile-web-app-title" content="从0制作自主空中机器人-5-Airsim-PX4仿真环境搭建"><meta name="application-name" content="从0制作自主空中机器人-5-Airsim-PX4仿真环境搭建"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="#18171d"><meta property="og:type" content="article"><meta property="og:title" content="从0制作自主空中机器人-5-Airsim-PX4仿真环境搭建"><meta property="og:url" content="https://www.mgodmonkey.cn/posts/982cb875.html"><meta property="og:site_name" content="MGodmonkeyの世界"><meta property="og:description" content="AirSim项目地址：https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;microsoft&amp;#x2F;AirSim AirSim官方教程：Home - AirSim (microsoft.github.io) CSDN参考教程: AirSim学习（1）安装Unreal Engine和AirSim 视频教程：   【Ai"><meta property="og:locale" content="zh-CN"><meta property="og:image" content="https://mybog.s3.bitiful.net/imgs/cover/cover_23.webp?_r_=aec10139-1087-2595-464e-c9d9570c297b"><meta property="article:author" content="MGodmonkey"><meta property="article:tag"><meta name="twitter:card" content="summary"><meta name="twitter:image" content="https://mybog.s3.bitiful.net/imgs/cover/cover_23.webp?_r_=aec10139-1087-2595-464e-c9d9570c297b"><meta name="description" content="AirSim项目地址：https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;microsoft&amp;#x2F;AirSim AirSim官方教程：Home - AirSim (microsoft.github.io) CSDN参考教程: AirSim学习（1）安装Unreal Engine和AirSim 视频教程：   【Ai"><link rel="shortcut icon" href="https://mybog.s3.bitiful.net/imgs/favicon.ico"><link rel="canonical" href="https://www.mgodmonkey.cn/posts/982cb875"><link rel="preconnect" href="//cdn.cbd.int"><meta name="google-site-verification" content="xxx"><meta name="baidu-site-verification" content="Sqt9yFIkjZdA89TY"><meta name="msvalidate.01" content="xxx"><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.cbd.int/@fortawesome/fontawesome-free@6.4.0/css/all.min.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="https://cdn.cbd.int/node-snackbar@0.1.16/dist/snackbar.min.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="https://cdn.cbd.int/@fancyapps/ui@5.0.28/dist/fancybox/fancybox.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="https://npm.elemecdn.com/anzhiyu-theme-static@1.0.0/swiper/swiper.min.css" media="print" onload='this.media="all"'><script>const GLOBAL_CONFIG={linkPageTop:{enable:!0,title:"与数百名博主无限进步",addFriendPlaceholder:"昵称（请勿包含博客等字样）：\n网站地址（要求博客地址，请勿提交个人主页）：\n头像图片url（请提供尽可能清晰的图片）：\n描述：\n站点截图（可选）：\n"},peoplecanvas:void 0,postHeadAiDescription:{enable:!0,gptName:"MGod",mode:"tianli",switchBtn:!1,btnLink:"https://afdian.net/item/886a79d4db6711eda42a52540025c377",randomNum:3,basicWordCount:1e3,key:"72937022917dd1869dad",Referer:"https://www.mgodmonkey.cn/"},diytitle:{enable:!0,leaveTitle:"空巢啦🪹",backTitle:"有蛋了🪺"},LA51:{enable:!0,ck:"K52IQR51E1m8suUy",LingQueMonitorID:"K7A7hMgFTh8JNQPk"},greetingBox:{enable:!0,default:"晚上好👋",list:[{greeting:"晚安😴",startTime:0,endTime:5},{greeting:"早上好鸭👋, 祝你一天好心情！",startTime:6,endTime:9},{greeting:"上午好👋, 状态很好，鼓励一下～",startTime:10,endTime:10},{greeting:"11点多啦, 在坚持一下就吃饭啦～",startTime:11,endTime:11},{greeting:"午安👋, 宝贝",startTime:12,endTime:14},{greeting:"🌈充实的一天辛苦啦！",startTime:14,endTime:18},{greeting:"19点喽, 奖励一顿丰盛的大餐吧🍔。",startTime:19,endTime:19},{greeting:"晚上好👋, 在属于自己的时间好好放松😌~",startTime:20,endTime:24}]},twikooEnvId:"https://twikoo.mgodmonkey.cn/",commentBarrageConfig:{enable:!0,maxBarrage:1,barrageTime:4e3,accessToken:"",mailMd5:""},music_page_default:"nav_music",root:"/",preloader:{source:3},friends_vue_info:void 0,navMusic:!0,mainTone:void 0,authorStatus:{skills:["🤖️ 数码科技爱好者","🔍 分享与热心帮助","🏠 智能家居小能手","🔨 设计开发一条龙","🤝 专修交互与设计","🏃 脚踏实地行动派","🧱 团队小组发动机","💢 壮汉人狠话不多"]},algolia:{appId:"LV9W14O4EO",apiKey:"0fa7b66b1866f423485b93e1e98ceb34",indexName:"hexo",hits:{per_page:6},languages:{input_placeholder:"输入关键词后按下回车查找",hits_empty:"找不到您查询的内容：${query}",hits_stats:"找到 ${hits} 条结果，用时 ${time} 毫秒"}},localSearch:void 0,translate:{defaultEncoding:2,translateDelay:0,msgToTraditionalChinese:"繁",msgToSimplifiedChinese:"简",rightMenuMsgToTraditionalChinese:"转为繁体",rightMenuMsgToSimplifiedChinese:"转为简体"},noticeOutdate:{limitDay:365,position:"top",messagePrev:"It has been",messageNext:"days since the last update, the content of the article may be outdated."},highlight:{plugin:"highlight.js",highlightCopy:!0,highlightLang:!0,highlightHeightLimit:330},copy:{success:"复制成功",error:"复制错误",noSupport:"浏览器不支持"},relativeDate:{homepage:!1,simplehomepage:!1,post:!1},runtime:"天",date_suffix:{just:"刚刚",min:"分钟前",hour:"小时前",day:"天前",month:"个月前"},copyright:{copy:!0,copyrightEbable:!1,limitCount:50,languages:{author:"作者: MGodmonkey",link:"链接: ",source:"来源: MGodmonkeyの世界",info:"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。",copySuccess:"复制成功，复制和转载请标注本文地址"}},lightbox:"fancybox",Snackbar:{chs_to_cht:"你已切换为繁体",cht_to_chs:"你已切换为简体",day_to_night:"你已切换为深色模式",night_to_day:"你已切换为浅色模式",bgLight:"#3b70fc",bgDark:"#1f1f1f",position:"top-center"},source:{justifiedGallery:{js:"https://cdn.cbd.int/flickr-justified-gallery@2.1.2/dist/fjGallery.min.js",css:"https://cdn.cbd.int/flickr-justified-gallery@2.1.2/dist/fjGallery.css"}},isPhotoFigcaption:!1,islazyload:!0,isAnchor:!1,shortcutKey:{enable:!0,delay:100,shiftDelay:200},autoDarkmode:!0}</script><script id="config-diff">var GLOBAL_CONFIG_SITE={configTitle:"MGodmonkeyの世界",title:"从0制作自主空中机器人-5-Airsim-PX4仿真环境搭建",postAI:"true",pageFillDescription:"1.AirSim-Windows环境配置, 1.1Build Airsim, 1.2自定义场景, 2. WSL2或者VM虚拟机环境配置项目地址官方教程参考教程学习安装和视频教程我有自己的无人机啦的讲解在自己的上实现仿真知乎环境配置注环境需要自行安装或以上版本推荐以及在上运行在或者虚拟机上通过控制无人机安装虚拟引擎下载并安装虽然虚幻引擎是开源和免费下载的但仍然需要注册运行打开左侧窗格中的虚幻引擎选项卡单击右上角的安装按钮该按钮应显示下载推荐的选项选择安装位置以满足您的需求如下图所示如果您安装了多个版本的请单击该版本的启动按钮旁边的向下箭头以确保将您使用的版本设置为当前如果您有或更旧的项目请参阅升级指南来升级您的项目安装安装教程确保选择安装时勾选了桌面开发和如果是还需要选择的进行桌面开发默认情况下应选择然后选择最新的下的单个组件选项卡同时安装安装参考这个教程安装版本选择最好安装知乎下载源码到本地国内网络环境不好时选择下面安装依赖项并编译下载并安装安装时记得勾选添加到环境中安装完后重启电脑以生效环境打开在搜索中搜索然后使用管理员打开记得进入所在的目录输入进行编译如果在下面的过程中卡壳了终止编译然后重新编译直到下载完成并正常编译完成使用编译打开使用进入执行双击打开会自动启动右键设为为启动项目编译器选择然后启动本地调试器编译完成自动打开虚幻引擎点击运行点击是选择仿真车点击否选择仿真无人机当出现下面的画面则表示环境搭建成功自定义场景创建一个自定义的虚拟场景并通过加载打开点击虚幻商城搜索环境类型的素材推荐免费搜索或筛选结果选择免费添加致购物车进行购买点击上方的库选择刚才购买的创建工程选定路径导入完成后双击打开该工程注如果加载过程中黑屏或者卡住可以重启如果实在打开太卡或太慢可以选择上面购买第二个那个轻量版地图关闭工程将文件夹复制到刚才的工程目录下然后双击弹出窗口点击是重新编译完成后右下角弹出更新插件点击管理插件即可看到插件添加到工程中然后点击功能栏的设置世界场景设置游戏模式重载选择点击运行如果出现弹窗选择是启动车辆仿真否启动无人机仿真按查看帮助修改配置文件前往你的用户名文件配置项参考以下是推荐的配置文件需要搭配第二部分的设置使用其中为本机的地址通过指令输入进行查看一般为或者其他你可以通过或者虚拟机一下看看通不通或者虚拟机环境配置注或虚拟机需要如下环境系统或者安装参考资源汇总仿真安装参考从制作自主空中机器人与入门以及一些常见的软件安装参考从制作自主空中机器人环境与常用软件安装复制一份工程目录到或虚拟机初试化编译包配置环境地址为运行的的记得查看一下自己的路径对不对开放防火墙如果没有装防火墙就不需要这一步了在中启动记得修改配置文件后重新启动窗口显示等待连接在或者虚拟机中启动仿真和出现下面的提示则说明与连接成功启动通过查看有没有一下主题即可说明是否连接正常各个话题和订阅者功能如下与全球框架相对应的坐标这将在的文件中的键下进行设置这是无人机在中的当前坐标框架默认名称发射名称和框架类型可配置中与起飞点的测距或浮点图像取决于中要求的图像类型这是高度计当前的高度压力和温度读数传感器数据测量磁场矢量罗盘测量与活动者的距离如红外线或红外信号激光雷达点云忽略字段将其留空今后我们将对多架无人机使用字段忽略字段将其留空今后我们将对多架无人机使用字段以欧拉角为单位的万向节设定点以四元数表示的万向节设定点油门刹车转向和档位选择控制可控制自动和手动变速箱使用方法请参见脚本重置所有无人机默认值设置为可自动切换到框架默认值如果将设置为则默认名称将改为默认值如果将设置为该设置将默认为默认值秒计时器回调频率用于从更新无人机和状态以及发送控制命令当前与虚幻引擎的接口最大频率为赫兹中的定时器回调以最大速率运行因此最好不要触及此参数默认值秒从中所有摄像机接收图像的定时器回调频率速度取决于请求图像的数量和分辨率中的定时回调以最大可能的速度运行因此最好不要触及此参数默认值设置为时将发布主题注启动连接成功后可以通过地面站一键起飞无人机",isPost:!0,isHome:!1,isHighlightShrink:!1,isToc:!0,postUpdate:"2024-06-18 16:31:53",postMainColor:""}</script><noscript><style>#nav{opacity:1}.justified-gallery img{opacity:1}#post-meta time,#recent-posts time{display:inline!important}</style></noscript><script>(e=>{e.saveToLocal={set:(e,t,a)=>{if(0===a)return;const o={value:t,expiry:Date.now()+864e5*a};localStorage.setItem(e,JSON.stringify(o))},get:e=>{const t=localStorage.getItem(e);if(!t)return;const a=JSON.parse(t);if(!(Date.now()>a.expiry))return a.value;localStorage.removeItem(e)}},e.getScript=(e,t={})=>new Promise(((a,o)=>{const c=document.createElement("script");c.src=e,c.async=!0,c.onerror=o,c.onload=c.onreadystatechange=function(){const e=this.readyState;e&&"loaded"!==e&&"complete"!==e||(c.onload=c.onreadystatechange=null,a())},Object.keys(t).forEach((e=>{c.setAttribute(e,t[e])})),document.head.appendChild(c)})),e.getCSS=(e,t=!1)=>new Promise(((a,o)=>{const c=document.createElement("link");c.rel="stylesheet",c.href=e,t&&(c.id=t),c.onerror=o,c.onload=c.onreadystatechange=function(){const e=this.readyState;e&&"loaded"!==e&&"complete"!==e||(c.onload=c.onreadystatechange=null,a())},document.head.appendChild(c)})),e.activateDarkMode=()=>{document.documentElement.setAttribute("data-theme","dark"),null!==document.querySelector('meta[name="theme-color"]')&&document.querySelector('meta[name="theme-color"]').setAttribute("content","#18171d")},e.activateLightMode=()=>{document.documentElement.setAttribute("data-theme","light"),null!==document.querySelector('meta[name="theme-color"]')&&document.querySelector('meta[name="theme-color"]').setAttribute("content","#f7f9fe")};const t=saveToLocal.get("theme"),a=window.matchMedia("(prefers-color-scheme: dark)").matches,o=window.matchMedia("(prefers-color-scheme: light)").matches,c=window.matchMedia("(prefers-color-scheme: no-preference)").matches,n=!a&&!o&&!c;if(void 0===t){if(o)activateLightMode();else if(a)activateDarkMode();else if(c||n){const e=(new Date).getHours();e<=6||e>=18?activateDarkMode():activateLightMode()}window.matchMedia("(prefers-color-scheme: dark)").addListener((e=>{void 0===saveToLocal.get("theme")&&(e.matches?activateDarkMode():activateLightMode())}))}else"light"===t?activateLightMode():activateDarkMode();const d=saveToLocal.get("aside-status");void 0!==d&&("hide"===d?document.documentElement.classList.add("hide-aside"):document.documentElement.classList.remove("hide-aside"));/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)&&document.documentElement.classList.add("apple")})(window)</script><link rel="stylesheet" href="/css/custom.css" onload='this.media="all"'><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiperstyle.css" media="print" onload='this.media="all"'><meta name="generator" content="Hexo 6.3.0"><link rel="alternate" href="/atom.xml" title="MGodmonkeyの世界" type="application/atom+xml"></head><body data-type="anzhiyu"><div id="web_bg"></div><div id="an_music_bg"></div><div id="loading-box" onclick="document.getElementById(&quot;loading-box&quot;).classList.add(&quot;loaded&quot;)"><div class="loading-bg"><img class="loading-img nolazyload" alt="加载头像" src="https://mybog.s3.bitiful.net/imgs/head.jpg"><div class="loading-image-dot"></div></div></div><script>const preloader={endLoading:()=>{document.getElementById("loading-box").classList.add("loaded")},initLoading:()=>{document.getElementById("loading-box").classList.remove("loaded")}};window.addEventListener("load",(()=>{preloader.endLoading()})),setTimeout((function(){preloader.endLoading()}),1e4),document.addEventListener("pjax:send",(()=>{preloader.initLoading()})),document.addEventListener("pjax:complete",(()=>{preloader.endLoading()}))</script><link rel="stylesheet" href="https://cdn.cbd.int/anzhiyu-theme-static@1.1.10/progress_bar/progress_bar.css"><script async src="https://cdn.cbd.int/pace-js@1.2.4/pace.min.js" data-pace-options="{ &quot;restartOnRequestAfter&quot;:false,&quot;eventLag&quot;:false}"></script><div class="post" id="body-wrap"><header class="post-bg" id="page-header"><nav id="nav"><div id="nav-group"><span id="blog_name"><div class="back-home-button"><i class="anzhiyufont anzhiyu-icon-grip-vertical"></i><div class="back-menu-list-groups"><div class="back-menu-list-group"><div class="back-menu-list-title">网页</div><div class="back-menu-list"><a class="back-menu-item" href="https://www.mgodmonkey.cn/" title="博客"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/favicon.ico" alt="博客"><span class="back-menu-item-text">博客</span></a></div></div><div class="back-menu-list-group"><div class="back-menu-list-title">AI项目</div><div class="back-menu-list"><a class="back-menu-item" target="_blank" rel="noopener" href="https://chat.mgodmonkey.cn/" title="ChatGPT"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/圣女果.svg" alt="ChatGPT"><span class="back-menu-item-text">ChatGPT</span></a><a class="back-menu-item" target="_blank" rel="noopener" href="https://newchat.mgodmonkey.cn/" title="NewChatGPT"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/苹果.svg" alt="NewChatGPT"><span class="back-menu-item-text">NewChatGPT</span></a><a class="back-menu-item" target="_blank" rel="noopener" href="https://autogpt.mgodmonkey.cn/" title="AutoGPT"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/火龙果.svg" alt="AutoGPT"><span class="back-menu-item-text">AutoGPT</span></a><a class="back-menu-item" target="_blank" rel="noopener" href="https://academic.chatwithpaper.org/" title="AcademicGPT"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/石榴.svg" alt="AcademicGPT"><span class="back-menu-item-text">AcademicGPT</span></a><a class="back-menu-item" target="_blank" rel="noopener" href="https://chatwithpaper.org/" title="Chatpaper"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/芒果.svg" alt="Chatpaper"><span class="back-menu-item-text">Chatpaper</span></a></div></div><div class="back-menu-list-group"><div class="back-menu-list-title">其他</div><div class="back-menu-list"><a class="back-menu-item" target="_blank" rel="noopener" href="https://memos.mgodmonkey.cn/" title="Memos"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/圣女果.svg" alt="Memos"><span class="back-menu-item-text">Memos</span></a><a class="back-menu-item" target="_blank" rel="noopener" href="https://github.com/MGod-monkey/Must_Pass_Experiment_of_TY" title="必过通原"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/苹果.svg" alt="必过通原"><span class="back-menu-item-text">必过通原</span></a></div></div></div></div><a id="site-name" href="/" accesskey="h"><div class="title">MGodmonkeyの世界</div><i class="anzhiyufont anzhiyu-icon-house-chimney"></i></a></span><div class="mask-name-container"><div id="name-container"><a id="page-name" href="javascript:anzhiyu.scrollToDest(0, 500)">PAGE_NAME</a></div></div><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span>文章</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/archives/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu-kele"></use></svg> <span>归档</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/tags/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu-zhaji"></use></svg> <span>标签</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/categories/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu-denglong"></use></svg> <span>分类</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span>休闲</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" target="_blank" rel="noopener" href="https://music.mgodmonkey.cn"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu-erji"></use></svg> <span>音乐</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/life/bangumis/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu-kafei"></use></svg> <span>番剧</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/life/air-conditioner"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-chonglang"></use></svg> <span>空调</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span>社交</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/comments/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon--chat"></use></svg> <span>留言板</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/album/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-zhaopian_1"></use></svg> <span>相册集</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/album/MyFavoriteBaby/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xingsu"></use></svg> <span>大陆养虾</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/social/link/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu_shu"></use></svg> <span>加入友链</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span>个人</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/personal/essay/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu_qizhi"></use></svg> <span>说说</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/personal/task_list/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu_xiaoya"></use></svg> <span>清单</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/personal/equipment/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu_xigua"></use></svg> <span>装备</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/personal/about/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu_aixin"></use></svg> <span>关于</span></a></li></ul></div></div></div><div id="nav-right"><div class="nav-button only-home" id="travellings_button" title="随机前往一个开往项目网站"><a class="site-page" onclick="anzhiyu.totraveling()" title="随机前往一个开往项目网站" href="javascript:void(0);" rel="external nofollow" data-pjax-state="external"><i class="anzhiyufont anzhiyu-icon-train"></i></a></div><div class="nav-button" id="randomPost_button"><a class="site-page" onclick="toRandomPost()" title="随机前往一个文章" href="javascript:void(0);"><i class="anzhiyufont anzhiyu-icon-dice"></i></a></div><div class="nav-button" id="search-button"><a class="site-page social-icon search" href="javascript:void(0);" title="搜索🔍" accesskey="s"><i class="anzhiyufont anzhiyu-icon-magnifying-glass"></i> <span>搜索</span></a></div><input id="center-console" type="checkbox"><label class="widget" for="center-console" title="中控台" onclick="anzhiyu.switchConsole()"><i class="left"></i><i class="widget center"></i><i class="widget right"></i></label><div id="console"><div class="console-card-group-reward"><ul class="reward-all console-card"><li class="reward-item"><a href="https://mybog.s3.bitiful.net/imgs/reward_wechat.png" target="_blank"><img class="post-qr-code-img" alt="微信" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/reward_wechat.png"></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="https://mybog.s3.bitiful.net/imgs/reward_alipay.png" target="_blank"><img class="post-qr-code-img" alt="支付宝" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/reward_alipay.png"></a><div class="post-qr-code-desc">支付宝</div></li></ul></div><div class="console-card-group"><div class="console-card-group-left"><div class="console-card" id="card-newest-comments"><div class="card-content"><div class="author-content-item-tips">互动</div><span class="author-content-item-title">最新评论</span></div><div class="aside-list"><span>正在加载中...</span></div></div></div><div class="console-card-group-right"><div class="console-card tags"><div class="card-content"><div class="author-content-item-tips">音乐</div><span class="author-content-item-title">灵魂的碰撞💥</span></div></div><div class="console-card history"><div class="item-headline"><i class="anzhiyufont anzhiyu-icon-box-archiv"></i><span>文章</span></div><div class="card-archives"><div class="item-headline"><i class="anzhiyufont anzhiyu-icon-archive"></i><span>归档</span><a class="card-more-btn" href="/archives/" title="查看更多"><i class="anzhiyufont anzhiyu-icon-angle-right"></i></a></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/06/"><span class="card-archive-list-date">六月 2024</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">1</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/05/"><span class="card-archive-list-date">五月 2024</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">1</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/04/"><span class="card-archive-list-date">四月 2024</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">1</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/03/"><span class="card-archive-list-date">三月 2024</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">1</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/02/"><span class="card-archive-list-date">二月 2024</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">2</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/09/"><span class="card-archive-list-date">九月 2023</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">1</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/08/"><span class="card-archive-list-date">八月 2023</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">5</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/07/"><span class="card-archive-list-date">七月 2023</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">7</span><span>篇</span></div></a></li></ul></div><hr></div></div></div><div class="button-group"><div class="console-btn-item"><a class="darkmode_switchbutton" title="显示模式切换" href="javascript:void(0);"><i class="anzhiyufont anzhiyu-icon-moon"></i></a></div><div class="console-btn-item" id="consoleHideAside" onclick="anzhiyu.hideAsideBtn()" title="边栏显示控制"><a class="asideSwitch"><i class="anzhiyufont anzhiyu-icon-arrows-left-right"></i></a></div><div class="console-btn-item on" id="consoleCommentBarrage" onclick="anzhiyu.switchCommentBarrage()" title="热评开关"><a class="commentBarrage"><i class="anzhiyufont anzhiyu-icon-message"></i></a></div><div class="console-btn-item" id="consoleMusic" onclick="anzhiyu.musicToggle()" title="音乐开关"><a class="music-switch"><i class="anzhiyufont anzhiyu-icon-music"></i></a></div><div class="console-btn-item" id="consoleKeyboard" onclick="anzhiyu.keyboardToggle()" title="快捷键开关"><a class="keyboard-switch"><i class="anzhiyufont anzhiyu-icon-keyboard"></i></a></div></div><div class="console-mask" onclick="anzhiyu.hideConsole()" href="javascript:void(0);"></div></div><div class="nav-button" id="nav-totop"><a class="totopbtn" href="javascript:void(0);"><i class="anzhiyufont anzhiyu-icon-arrow-up"></i><span id="percent" onclick="anzhiyu.scrollToDest(0,500)">0</span></a></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);" title="切换"><i class="anzhiyufont anzhiyu-icon-bars"></i></a></div></div></div></nav><div id="post-info"><div id="post-firstinfo"><div class="meta-firstline"><a class="post-meta-original">原创</a><span class="post-meta-categories"><span class="post-meta-separator"></span><i class="anzhiyufont anzhiyu-icon-inbox post-meta-icon"></i><a class="post-meta-categories" href="/categories/Airsim/" itemprop="url">Airsim</a></span><span class="article-meta tags"><a class="article-meta__tags" href="/tags/ros/" tabindex="-1" itemprop="url"><span><i class="anzhiyufont anzhiyu-icon-hashtag"></i> ros</span></a><a class="article-meta__tags" href="/tags/%E6%97%A0%E4%BA%BA%E6%9C%BA/" tabindex="-1" itemprop="url"><span><i class="anzhiyufont anzhiyu-icon-hashtag"></i> 无人机</span></a><a class="article-meta__tags" href="/tags/%E4%BB%BF%E7%9C%9F/" tabindex="-1" itemprop="url"><span><i class="anzhiyufont anzhiyu-icon-hashtag"></i> 仿真</span></a></span></div></div><h1 class="post-title" itemprop="name headline">从0制作自主空中机器人-5-Airsim-PX4仿真环境搭建</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="anzhiyufont anzhiyu-icon-calendar-days post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" itemprop="dateCreated datePublished" datetime="2024-06-11T01:44:00.000Z" title="发表于 2024-06-11 09:44:00">2024-06-11</time><span class="post-meta-separator"></span><i class="anzhiyufont anzhiyu-icon-history post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" itemprop="dateCreated datePublished" datetime="2024-06-18T08:31:53.379Z" title="更新于 2024-06-18 16:31:53">2024-06-18</time></span></div><div class="meta-secondline"><span class="post-meta-separator"></span><span class="post-meta-wordcount"><i class="anzhiyufont anzhiyu-icon-file-word post-meta-icon" title="文章字数"></i><span class="post-meta-label" title="文章字数">字数总计:</span><span class="word-count" title="文章字数">2668</span><span class="post-meta-separator"></span><i class="anzhiyufont anzhiyu-icon-clock post-meta-icon" title="阅读时长"></i><span class="post-meta-label" title="阅读时长">阅读时长:</span><span>11分钟</span></span><span class="post-meta-separator"></span><span class="post-meta-position" title="作者IP属地为广西"><i class="anzhiyufont anzhiyu-icon-location-dot"></i> 广西</span></div></div></div><section class="main-hero-waves-area waves-area"><svg class="waves-svg" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto"><defs><path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s58 18 88 18 58-18 88-18 58 18 88 18v44h-352Z"></path></defs><g class="parallax"><use href="#gentle-wave" x="48" y="0"></use><use href="#gentle-wave" x="48" y="3"></use><use href="#gentle-wave" x="48" y="5"></use><use href="#gentle-wave" x="48" y="7"></use></g></svg></section><div id="post-top-cover"><img class="nolazyload" id="post-top-bg" src="https://mybog.s3.bitiful.net/imgs/cover/cover_23.webp?_r_=aec10139-1087-2595-464e-c9d9570c297b"></div></header><main id="blog-container"><div class="layout" id="content-inner"><div id="post"><div class="post-ai-description"><div class="ai-title"><i class="anzhiyufont anzhiyu-icon-bilibili"></i><div class="ai-title-text">AI-摘要</div><i class="anzhiyufont anzhiyu-icon-arrow-rotate-right"></i><i class="anzhiyufont anzhiyu-icon-circle-dot" title="朗读摘要"></i><div id="ai-tag">MGodのGPT</div></div><div class="ai-explanation">AI初始化中...</div><div class="ai-btn-box"><div class="ai-btn-item">介绍自己</div><div class="ai-btn-item">生成本文简介</div><div class="ai-btn-item">推荐相关文章</div><div class="ai-btn-item">前往主页</div><div class="ai-btn-item" id="go-tianli-blog">前往爱发电购买</div></div><script data-pjax src="/js/anzhiyu/ai_abstract.js"></script></div><article class="post-content" id="article-container" itemscope itemtype="https://www.mgodmonkey.cn/posts/982cb875.html"><header><a class="post-meta-categories" href="/categories/Airsim/" itemprop="url">Airsim</a><a href="/tags/ros/" tabindex="-1" itemprop="url">ros</a><a href="/tags/%E6%97%A0%E4%BA%BA%E6%9C%BA/" tabindex="-1" itemprop="url">无人机</a><a href="/tags/%E4%BB%BF%E7%9C%9F/" tabindex="-1" itemprop="url">仿真</a><h1 id="CrawlerTitle" itemprop="name headline">从0制作自主空中机器人-5-Airsim-PX4仿真环境搭建</h1><span itemprop="author" itemscope itemtype="http://schema.org/Person">MGodmonkey</span><time itemprop="dateCreated datePublished" datetime="2024-06-11T01:44:00.000Z" title="发表于 2024-06-11 09:44:00">2024-06-11</time><time itemprop="dateCreated datePublished" datetime="2024-06-18T08:31:53.379Z" title="更新于 2024-06-18 16:31:53">2024-06-18</time></header><blockquote><p><strong>AirSim项目地址：</strong><a target="_blank" rel="noopener" href="https://github.com/microsoft/AirSim">https://github.com/microsoft/AirSim</a></p><p><strong>AirSim官方教程：</strong><a target="_blank" rel="noopener" href="https://microsoft.github.io/AirSim/">Home - AirSim (microsoft.github.io)</a></p><p><strong>CSDN参考教程:</strong> <a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_45709806/article/details/136062458">AirSim学习（1）安装Unreal Engine和AirSim</a></p><p><strong>视频教程：</strong></p><ul><li><p><a target="_blank" rel="noopener" href="https://www.bilibili.com/video/BV1Rz4y1t7Zf">【AirSim】我有自己的无人机啦 - bilibili</a></p></li><li><p><a target="_blank" rel="noopener" href="https://www.zhihu.com/zvideo/1365229339978682368">Chris Lovett的讲解在自己的Windows上实现AirSim仿真 - 知乎 (zhihu.com)</a></p></li></ul></blockquote><h2 id="1-AirSim-Windows环境配置">1.AirSim-Windows环境配置</h2><blockquote><p><strong>注：Windows环境需要自行安装VS2022或以上版本，Unreal Engine &gt;= 4.27（推荐4.27），以及wsl2（在Windows上运行Airsim，在wsl或者vm虚拟机上通过ros控制无人机）</strong></p><ul><li><p>安装虚拟引擎</p><ul><li><p>1.<a target="_blank" rel="noopener" href="https://www.unrealengine.com/download">【下载并安装EPIC】</a> ，虽然虚幻引擎是开源和免费下载的，但仍然需要注册</p></li><li><p>2.运行<strong>Epic Games Launcher</strong>，打开左侧窗格中的 “<strong>虚幻引擎</strong>” 选项卡。单击右上角的 “<strong>安装</strong>” 按钮，该按钮应显示下载 <strong>UE&gt; = 4.27（推荐4.27）</strong> 的选项。选择安装位置以满足您的需求，如下图所示。如果您安装了多个版本的<strong>Unreal</strong>，请单击该版本的启动按钮旁边的向下箭头，以确保将您使用的版本设置为 “<strong>当前</strong>”。</p><p><strong>Note</strong>: 如果您有UE 4.16或更旧的项目，请参阅 [升级指南](https:// <a target="_blank" rel="noopener" href="http://microsoft.github.io/AirSim/unreal_upgrade/">microsoft.github.io/AirSim/unreal_upgrade/</a>) 来升级您的项目。</p></li></ul></li><li><p>安装VS2022</p><ul><li>1.<a target="_blank" rel="noopener" href="https://mp.weixin.qq.com/s?__biz=MzA4MjU4MTg2Ng==&amp;mid=2247523511&amp;idx=7&amp;sn=57646ed6e7f178334c8a7a3593022f0e&amp;chksm=9f815cb2a8f6d5a406cb4bd9ab4d578c67a8556f9296a579f351df0c895290d3ad479dfcd138&amp;scene=21#wechat_redirect">Visual Studio2022安装教程 (qq.com)</a>。确保选择安装时勾选了<strong>C ++桌面开发</strong> 和**Windows 10 SDK 10.0.19041（如果是Windows11还需要选择Windows11的SDK）**进行桌面开发 (默认情况下应选择)，然后选择最新的。<strong>NET Framework SDK</strong>下的 “<strong>单个组件</strong>” 选项卡，同时安装VS 2022。</li></ul><p><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/02/28/37yMhW9EUtpa2cB.png" alt=""></p></li><li><p>Windows安装wsl2</p><ul><li><strong>参考这个教程安装（ubuntu版本选择20最好）：</strong><a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/475462241">Windows 11 安装 WSL2 - 知乎</a></li></ul></li></ul></blockquote><h3 id="1-1Build-Airsim">1.1Build Airsim</h3><ol><li><p>下载源码到本地</p><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> https://github.com/microsoft/AirSim.git</span><br><span class="line"><span class="comment"># 国内网络环境不好时选择下面</span></span><br><span class="line">git <span class="built_in">clone</span> https://github.moeyy.xyz/https://github.com/microsoft/AirSim.git</span><br></pre></td></tr></table></figure></li><li><p>安装依赖项并编译</p><ol><li><p><a target="_blank" rel="noopener" href="https://cmake.org/download/">【下载并安装Cmake】</a>，安装时记得勾选添加到环境中</p><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/02/28/BnefXiZt3bp8lvY.png" style="zoom:50%"></li><li><p>安装<strong>Cmake</strong>完后重启电脑以生效环境，打开<code>Developer Command Prompt for VS 2022</code>，在Windows搜索中搜索然后使用管理员打开，<code>cd AirSim</code>记得cd进入Airsim所在的目录</p></li><li><p>输入<code>.\build.cmd</code>进行编译Airsim，如果在下面的过程中卡壳了，<strong>Ctrl+C</strong>终止编译，然后重新编译，直到下载完成并正常编译完成</p></li></ol></li></ol><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/02/28/3RUyckmza5Twj9b.png" style="zoom:50%"><ol start="3"><li><p>使用<strong>VS2022</strong>编译打开</p><ol><li><p>使用<code>Developer Command Prompt for VS 2022</code>进入<code>AirSim\Unreal\Environments\Blocks</code>，执行<code>.\update_from_git.bat</code></p></li><li><p>双击打开<code>Blocks.sln</code>，会自动启动<strong>VS2022</strong></p></li><li><p>右键<code>Block</code>设为为启动项目</p><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/03/28/6ALzG4JCR3QOdgb.png" style="zoom:80%"></li><li><p>编译器选择<code>DebugGame Editor</code>，然后启动<strong>本地Windows调试器</strong>，编译完成自动打开虚幻引擎</p><p><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/03/28/V7Isc4tQrbgJvXk.png" alt=""></p></li><li><p>点击运行，点击**‘是’<strong>选择仿真车，点击</strong>’否’**选择仿真无人机，当出现下面的画面则表示环境搭建成功</p><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/03/28/oEuhpY5cqtKIGbS.png" style="zoom:50%"></li></ol></li></ol><h3 id="1-2自定义场景">1.2自定义场景</h3><blockquote><p>创建一个自定义的虚拟场景，并通过<strong>Airsim</strong>加载</p></blockquote><ol><li><p>打开<strong>Epic</strong> -&gt; 点击<strong>虚幻商城</strong> -&gt; 搜索<strong>环境</strong>类型的素材（推荐免费：搜索&quot;<strong>Assetsville Town或City Park</strong>&quot; -&gt; 筛选结果选择免费 -&gt; 添加致购物车进行购买）-&gt; 点击上方的<strong>库</strong>，选择刚才购买的<strong>City Park</strong>创建工程，选定路径</p><p><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/06/11/opNvHEOc7L9dnGV.png" alt="image-20240611162643650"></p><p><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/06/11/tlpfGvI9JxaKE2N.png" alt="image-20240611163507427"></p></li><li><p>导入完成后双击打开该工程</p><blockquote><p>注：如果加载过程中黑屏或者卡住可以重启<strong>Unreal Engine</strong>，如果实在打开太卡或太慢可以选择上面购买<strong>City Park</strong>第二个那个轻量版地图</p></blockquote><p><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/06/11/oZ7UkgFCfnQ8TVt.png" alt="image-20240611192338259"></p></li><li><p>关闭工程，将<code>AirSim\Unreal\Plugins</code>文件夹复制到刚才的工程目录下，然后双击<code>CityParkEnvironmentMini.uproject</code>，弹出<strong>Rebuild</strong>窗口，点击<strong>是</strong></p><p><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/06/11/8Elr6XORuQLNDof.png" alt="image-20240611195006551"></p></li><li><p>重新编译完成后，右下角弹出更新插件，点击<strong>管理插件</strong>即可看到<strong>AirSim插件</strong>添加到工程中，然后点击功能栏的<code>设置</code> -&gt; <code>世界场景设置</code> -&gt; 游戏模式重载选择<code>AirSimGameMode</code></p><p><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/06/11/c2L3lwUdXxyzbDT.png" alt="image-20240611195450875"></p><p><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/06/11/I1nkLQ9wtahvN8C.png" alt="image-20240611195844988"></p></li><li><p>点击运行，如果出现弹窗，选择<code>是</code>启动车辆仿真，<code>否</code>启动无人机仿真，按<code>F1</code>查看帮助</p><p><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/06/11/bmf5LCSIpjDP9Bu.png" alt="image-20240611200347055"></p><ol start="6"><li><p>修改配置文件，前往<code>C:\User\&#123;你的用户名&#125;\Documents\AirSim\Settings.json</code>,文件配置项参考<a target="_blank" rel="noopener" href="https://microsoft.github.io/AirSim/settings/">https://microsoft.github.io/AirSim/settings/</a>，以下是推荐的配置文件，需要搭配第二部分的设置使用，其中<strong>LocalHostIp</strong>为Windows本机的IP地址，通过cmd指令输入<code>ipconfig</code>进行查看，一般为192.168.1.x，或者其他，你可以通过<strong>WSL</strong>或者<strong>VM虚拟机</strong>ping一下看看通不通</p><figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;SettingsVersion&quot;</span><span class="punctuation">:</span> <span class="number">1.2</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;SimMode&quot;</span><span class="punctuation">:</span> <span class="string">&quot;Multirotor&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;ClockType&quot;</span><span class="punctuation">:</span> <span class="string">&quot;SteppableClock&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;Vehicles&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">        <span class="attr">&quot;PX4&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">            <span class="attr">&quot;VehicleType&quot;</span><span class="punctuation">:</span> <span class="string">&quot;PX4Multirotor&quot;</span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;UseSerial&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;LockStep&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;UseTcp&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;TcpPort&quot;</span><span class="punctuation">:</span> <span class="number">4560</span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;ControlIp&quot;</span><span class="punctuation">:</span> <span class="string">&quot;remote&quot;</span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;ControlPortLocal&quot;</span><span class="punctuation">:</span> <span class="number">14540</span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;ControlPortRemote&quot;</span><span class="punctuation">:</span> <span class="number">14580</span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;LocalHostIp&quot;</span><span class="punctuation">:</span> <span class="string">&quot;192.168.1.116&quot;</span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;Sensors&quot;</span><span class="punctuation">:</span><span class="punctuation">&#123;</span></span><br><span class="line">                <span class="attr">&quot;Barometer&quot;</span><span class="punctuation">:</span><span class="punctuation">&#123;</span></span><br><span class="line">                    <span class="attr">&quot;SensorType&quot;</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;Enabled&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;PressureFactorSigma&quot;</span><span class="punctuation">:</span> <span class="number">0.0001825</span></span><br><span class="line">                <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">                <span class="attr">&quot;Imu&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">                    <span class="attr">&quot;SensorType&quot;</span><span class="punctuation">:</span> <span class="number">2</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;Enabled&quot;</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;AngularRandomWalk&quot;</span><span class="punctuation">:</span> <span class="number">0.3</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;GyroBiasStabilityTau&quot;</span><span class="punctuation">:</span> <span class="number">500</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;GyroBiasStability&quot;</span><span class="punctuation">:</span> <span class="number">4.6</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;VelocityRandomWalk&quot;</span><span class="punctuation">:</span> <span class="number">0.24</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;AccelBiasStabilityTau&quot;</span><span class="punctuation">:</span> <span class="number">800</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;AccelBiasStability&quot;</span><span class="punctuation">:</span> <span class="number">36</span></span><br><span class="line">                <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">                <span class="attr">&quot;Gps&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">                    <span class="attr">&quot;SensorType&quot;</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;Enabled&quot;</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;EphTimeConstant&quot;</span><span class="punctuation">:</span> <span class="number">0.9</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;EpvTimeConstant&quot;</span><span class="punctuation">:</span> <span class="number">0.9</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;EphInitial&quot;</span><span class="punctuation">:</span> <span class="number">25</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;EpvInitial&quot;</span><span class="punctuation">:</span> <span class="number">25</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;EphFinal&quot;</span><span class="punctuation">:</span> <span class="number">0.1</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;EpvFinal&quot;</span><span class="punctuation">:</span> <span class="number">0.1</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;EphMin3d&quot;</span><span class="punctuation">:</span> <span class="number">3</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;EphMin2d&quot;</span><span class="punctuation">:</span> <span class="number">4</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;UpdateLatency&quot;</span><span class="punctuation">:</span> <span class="number">0.2</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;UpdateFrequency&quot;</span><span class="punctuation">:</span> <span class="number">50</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;StartupDelay&quot;</span><span class="punctuation">:</span> <span class="number">1</span></span><br><span class="line">                <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">                <span class="attr">&quot;Distance&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">                    <span class="attr">&quot;SensorType&quot;</span><span class="punctuation">:</span> <span class="number">5</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;Enabled&quot;</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">true</span></span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;MinDistance&quot;</span><span class="punctuation">:</span> <span class="number">0.2</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;MaxDistance&quot;</span><span class="punctuation">:</span> <span class="number">40</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;X&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span> <span class="attr">&quot;Y&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span> <span class="attr">&quot;Z&quot;</span><span class="punctuation">:</span> <span class="number">-1</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;Yaw&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span> <span class="attr">&quot;Pitch&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span> <span class="attr">&quot;Roll&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line">                    <span class="attr">&quot;DrawDebugPoints&quot;</span><span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span></span><br><span class="line">                <span class="punctuation">&#125;</span></span><br><span class="line">            <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;Parameters&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">                <span class="attr">&quot;NAV_RCL_ACT&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line">                <span class="attr">&quot;NAV_DLL_ACT&quot;</span><span class="punctuation">:</span> <span class="number">0</span><span class="punctuation">,</span></span><br><span class="line">                <span class="attr">&quot;COM_OBL_ACT&quot;</span><span class="punctuation">:</span> <span class="number">1</span><span class="punctuation">,</span></span><br><span class="line">                <span class="attr">&quot;LPE_LAT&quot;</span><span class="punctuation">:</span> <span class="number">47.641468</span><span class="punctuation">,</span></span><br><span class="line">                <span class="attr">&quot;LPE_LON&quot;</span><span class="punctuation">:</span> <span class="number">-122.140165</span></span><br><span class="line">            <span class="punctuation">&#125;</span></span><br><span class="line">        <span class="punctuation">&#125;</span></span><br><span class="line">    <span class="punctuation">&#125;</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure></li></ol><h2 id="2-WSL2或者VM虚拟机环境配置">2. WSL2或者VM虚拟机环境配置</h2><blockquote><p>注：WSL或VM虚拟机需要如下环境</p><ul><li>ubuntu系统</li><li>gcc&gt;=8：<code>gcc -v</code> <code>sudo apt install gcc</code></li><li>ROS1或者ROS2：安装参考<a href="https://www.mgodmonkey.cn/posts/232d6cf1.html">ROS 资源汇总</a></li><li>PX4仿真：安装参考<a href="https://www.mgodmonkey.cn/posts/cfe889db.html">从0制作自主空中机器人-4-【PX4与Gazebo入门】</a></li><li>QGC以及一些常见的软件：安装参考<a href="https://www.mgodmonkey.cn/posts/eb82f52e.html">从0制作自主空中机器人-3-【环境与常用软件安装】</a></li></ul></blockquote><ol><li><p>复制一份<code>AirSim</code>工程目录到<strong>WSL</strong>或<strong>VM虚拟机</strong></p><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Ubuntu18</span></span><br><span class="line">sudo apt-get install ros-melodic-tf2-sensor-msgs ros-melodic-tf2-geometry-msgs ros-melodic-mavros*</span><br><span class="line"><span class="comment"># Ubuntu20</span></span><br><span class="line">sudo apt-get install ros-noetic-tf2-sensor-msgs ros-noetic-tf2-geometry-msgs ros-noetic-mavros*</span><br><span class="line"><span class="comment"># 初试化AirSim</span></span><br><span class="line"><span class="built_in">cd</span> AirSim</span><br><span class="line">sudo bash ./setup.sh</span><br><span class="line">sudo bash ./build.sh</span><br></pre></td></tr></table></figure></li><li><p>编译ROS包</p><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># ROS1</span></span><br><span class="line"><span class="built_in">cd</span> AirSim/ros</span><br><span class="line">catkin_make</span><br><span class="line"><span class="comment"># ROS2</span></span><br><span class="line"><span class="built_in">cd</span> AirSim/ros2</span><br><span class="line">colcon build</span><br></pre></td></tr></table></figure></li><li><p>配置<code>~/.bashrc</code>环境</p><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># ip地址为运行airsim的Windows的ip</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;export PX4_SIM_HOST_ADDR=192.168.1.116&quot;</span> &gt;&gt; ~/.bashrc</span><br><span class="line"><span class="comment"># 记得查看一下自己的路径对不对</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;source ~/Airsim/ros/devel/setup.sh&quot;</span> &gt;&gt; ~/.bashrc</span><br><span class="line"><span class="built_in">source</span> ~/.bashrc</span><br></pre></td></tr></table></figure></li><li><p>开放防火墙（如果没有装防火墙就不需要这一步了）</p><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo ufw allow 4560</span><br><span class="line">sudo ufuw allow 10049</span><br></pre></td></tr></table></figure></li></ol></li><li><p>在Window中启动AirSim（记得修改配置文件后重新启动），窗口显示等待TCP连接</p><p><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/06/12/1tAXWDj4BySsT2H.png" alt="image-20240612155513180"></p></li><li><p>在<strong>WSL</strong>或者<strong>VM虚拟机</strong>中启动<code>PX4仿真</code>和<code>ROS&amp;rivz</code></p><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> ~/PX4-Autopilot</span><br><span class="line">make px4_sitl_default none_iris</span><br></pre></td></tr></table></figure><p>出现下面的提示则说明PX4与AirSim连接成功</p><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">PX4 SIM HOST: 192.168.1.117</span><br><span class="line">INFO  [simulator] Simulator using TCP on remote host 192.168.1.117 port 4560</span><br><span class="line">WARN  [simulator] Please ensure port 4560 is not blocked by a firewall.</span><br><span class="line">INFO  [simulator] Waiting <span class="keyword">for</span> simulator to accept connection on TCP port 4560</span><br><span class="line">INFO  [simulator] Simulator connected on TCP port 4560.</span><br><span class="line">INFO  [commander] LED: open /dev/led0 failed (22)</span><br><span class="line">INFO  [init] Mixer: etc/mixers/quad_w.main.mix on /dev/pwm_output0</span><br><span class="line">INFO  [init] setting PWM_AUX_OUT none</span><br><span class="line">INFO  [mavlink] mode: Normal, data rate: 4000000 B/s on udp port 18570 remote port 14550</span><br><span class="line">INFO  [mavlink] mode: Onboard, data rate: 4000000 B/s on udp port 14580 remote port 14540</span><br><span class="line">INFO  [mavlink] mode: Onboard, data rate: 4000 B/s on udp port 14280 remote port 14030</span><br><span class="line">INFO  [mavlink] mode: Gimbal, data rate: 400000 B/s on udp port 13030 remote port 13280</span><br><span class="line">INFO  [logger] logger started (mode=all)</span><br><span class="line">INFO  [logger] Start file <span class="built_in">log</span> (<span class="built_in">type</span>: full)</span><br><span class="line">INFO  [logger] [logger] ./log/2024-06-12/08_20_41.ulg	</span><br><span class="line">INFO  [logger] Opened full <span class="built_in">log</span> file: ./log/2024-06-12/08_20_41.ulg</span><br><span class="line">INFO  [mavlink] MAVLink only on localhost (<span class="built_in">set</span> param MAV_&#123;i&#125;_BROADCAST = 1 to <span class="built_in">enable</span> network)</span><br><span class="line">INFO  [mavlink] MAVLink only on localhost (<span class="built_in">set</span> param MAV_&#123;i&#125;_BROADCAST = 1 to <span class="built_in">enable</span> network)</span><br><span class="line">INFO  [px4] Startup script returned successfully</span><br><span class="line">pxh&gt; INFO  [tone_alarm] home <span class="built_in">set</span></span><br><span class="line">INFO  [tone_alarm] notify negative</span><br></pre></td></tr></table></figure><p>启动<code>ROS&amp;rivz</code></p><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">roslaunch airsim_ros_pkgs airsim_node.launch output:=screen host:=<span class="variable">$PX4_SIM_HOST_ADDR</span></span><br><span class="line">roslaunch airsim_ros_pkgs rviz.launch</span><br></pre></td></tr></table></figure><p>通过<code>rostopic list</code>查看有没有一下主题即可说明是否连接正常</p><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">laohanba@ubuntu:~/Airsim$ rostopic list</span><br><span class="line">/airsim_node/PX4/altimeter/Barometer</span><br><span class="line">/airsim_node/PX4/distance/Distance</span><br><span class="line">/airsim_node/PX4/environment</span><br><span class="line">/airsim_node/PX4/global_gps</span><br><span class="line">/airsim_node/PX4/gps/Gps</span><br><span class="line">/airsim_node/PX4/imu/Imu</span><br><span class="line">/airsim_node/PX4/magnetometer/magnetometer</span><br><span class="line">/airsim_node/PX4/odom_local_ned</span><br><span class="line">/airsim_node/PX4/vel_cmd_body_frame</span><br><span class="line">/airsim_node/PX4/vel_cmd_world_frame</span><br><span class="line">/airsim_node/gimbal_angle_euler_cmd</span><br><span class="line">/airsim_node/gimbal_angle_quat_cmd</span><br><span class="line">/airsim_node/origin_geo_point</span><br><span class="line">/rosout</span><br><span class="line">/rosout_agg</span><br><span class="line">/tf</span><br><span class="line">/tf_static</span><br></pre></td></tr></table></figure></li></ol><blockquote><p>各个话题和订阅者功能如下：</p><ul><li><p>Publishers:<a target="_blank" rel="noopener" href="https://microsoft.github.io/AirSim/airsim_ros_pkgs/#publishers">#</a></p><ul><li><p><code>/airsim_node/origin_geo_point</code> <a target="_blank" rel="noopener" href="https://github.com/microsoft/AirSim/tree/main/ros/src/airsim_ros_pkgs/msg/GPSYaw.msg">airsim_ros_pkgs/GPSYaw</a> 与全球 NED 框架相对应的 GPS 坐标。这将在 airsim 的 <a target="_blank" rel="noopener" href="https://microsoft.github.io/AirSim/settings/">settings.json</a> 文件中的 <code>OriginGeopoint</code> 键下进行设置</p></li><li><p><code>/airsim_node/VEHICLE_NAME/global_gps</code> <a target="_blank" rel="noopener" href="https://docs.ros.org/api/sensor_msgs/html/msg/NavSatFix.html">sensor_msgs/NavSatFix</a> 这是无人机在 airsim 中的当前 GPS 坐标</p></li><li><p><code>/airsim_node/VEHICLE_NAME/odom_local_ned</code> <a target="_blank" rel="noopener" href="https://docs.ros.org/api/nav_msgs/html/msg/Odometry.html">nav_msgs/Odometry</a> NED 框架（默认名称：oddom_local_ned，发射名称和框架类型可配置）中与起飞点的测距。</p></li><li><p><code>/airsim_node/VEHICLE_NAME/CAMERA_NAME/IMAGE_TYPE/camera_info</code> <a target="_blank" rel="noopener" href="https://docs.ros.org/api/sensor_msgs/html/msg/CameraInfo.html">sensor_msgs/CameraInfo</a></p></li><li><p><code>/airsim_node/VEHICLE_NAME/CAMERA_NAME/IMAGE_TYPE</code> <a target="_blank" rel="noopener" href="https://docs.ros.org/api/sensor_msgs/html/msg/Image.html">sensor_msgs/Image</a> RGB 或浮点图像，取决于 settings.json 中要求的图像类型。</p></li><li><p><code>/tf</code> <a target="_blank" rel="noopener" href="https://docs.ros.org/api/tf2_msgs/html/msg/TFMessage.html">tf2_msgs/TFMessage</a></p></li><li><p><code>/airsim_node/VEHICLE_NAME/altimeter/SENSOR_NAME</code> <a target="_blank" rel="noopener" href="https://github.com/microsoft/AirSim/blob/main/ros/src/airsim_ros_pkgs/msg/Altimeter.msg">airsim_ros_pkgs/Altimeter</a> 这是高度计当前的高度、压力和温度读数 <a target="_blank" rel="noopener" href="https://en.wikipedia.org/wiki/QNH">QNH</a></p></li><li><p><code>/airsim_node/VEHICLE_NAME/imu/SENSOR_NAME</code> <a target="_blank" rel="noopener" href="http://docs.ros.org/api/sensor_msgs/html/msg/Imu.html">sensor_msgs::Imu</a> IMU 传感器数据</p></li><li><p><code>/airsim_node/VEHICLE_NAME/magnetometer/SENSOR_NAME</code> <a target="_blank" rel="noopener" href="http://docs.ros.org/api/sensor_msgs/html/msg/MagneticField.html">sensor_msgs::MagneticField</a> 测量磁场矢量/罗盘</p></li><li><p><code>/airsim_node/VEHICLE_NAME/distance/SENSOR_NAME</code> <a target="_blank" rel="noopener" href="http://docs.ros.org/api/sensor_msgs/html/msg/Range.html">sensor_msgs::Range</a> 测量与活动者的距离，如红外线或红外信号</p></li><li><p><code>/airsim_node/VEHICLE_NAME/lidar/SENSOR_NAME</code> <a target="_blank" rel="noopener" href="http://docs.ros.org/api/sensor_msgs/html/msg/PointCloud2.html">sensor_msgs::PointCloud2</a> 激光雷达点云</p></li></ul></li><li><p>Subscribers:<a target="_blank" rel="noopener" href="https://microsoft.github.io/AirSim/airsim_ros_pkgs/#subscribers">#</a></p><ul><li><p><code>/airsim_node/vel_cmd_body_frame</code> <a target="_blank" rel="noopener" href="https://github.com/microsoft/AirSim/tree/main/ros/src/airsim_ros_pkgs/msg/VelCmd.msg">airsim_ros_pkgs/VelCmd</a> 忽略 <code>vehicle_name</code> 字段，将其留空。今后我们将对多架无人机使用 <code>vehicle_name</code> 字段</p></li><li><p><code>/airsim_node/vel_cmd_world_frame</code> <a target="_blank" rel="noopener" href="https://github.com/microsoft/AirSim/tree/main/ros/src/airsim_ros_pkgs/msg/VelCmd.msg">airsim_ros_pkgs/VelCmd</a> 忽略 <code>vehicle_name</code> 字段，将其留空。今后我们将对多架无人机使用 <code>vehicle_name</code> 字段</p></li><li><p><code>/gimbal_angle_euler_cmd</code> <a target="_blank" rel="noopener" href="https://github.com/microsoft/AirSim/tree/main/ros/src/airsim_ros_pkgs/msg/GimbalAngleEulerCmd.msg">airsim_ros_pkgs/GimbalAngleEulerCmd</a> 以欧拉角为单位的万向节设定点</p></li><li><p><code>/gimbal_angle_quat_cmd</code> <a target="_blank" rel="noopener" href="https://github.com/microsoft/AirSim/tree/main/ros/src/airsim_ros_pkgs/msg/GimbalAngleQuatCmd.msg">airsim_ros_pkgs/GimbalAngleQuatCmd</a> 以四元数表示的万向节设定点</p></li><li><p><code>/airsim_node/VEHICLE_NAME/car_cmd</code> <a target="_blank" rel="noopener" href="https://github.com/microsoft/AirSim/blob/main/ros/src/airsim_ros_pkgs/msg/CarControls.msg">airsim_ros_pkgs/CarControls</a> 油门、刹车、转向和档位选择控制。可控制自动和手动变速箱，使用方法请参见 <a target="_blank" rel="noopener" href="https://github.com/microsoft/AirSim/blob/main/ros/src/airsim_ros_pkgs/scripts/car_joy"><code>car_joy.py</code></a> 脚本</p></li></ul></li><li><p>Services:<a target="_blank" rel="noopener" href="https://microsoft.github.io/AirSim/airsim_ros_pkgs/#services">#</a></p><ul><li><p><code>/airsim_node/VEHICLE_NAME/land</code> <a target="_blank" rel="noopener" href="https://docs.ros.org/api/std_srvs/html/srv/Empty.html">airsim_ros_pkgs/Takeoff</a></p></li><li><p><code>/airsim_node/takeoff</code> <a target="_blank" rel="noopener" href="https://docs.ros.org/api/std_srvs/html/srv/Empty.html">airsim_ros_pkgs/Takeoff</a></p></li><li><p><code>/airsim_node/reset</code> <a target="_blank" rel="noopener" href="https://docs.ros.org/api/std_srvs/html/srv/Empty.html">airsim_ros_pkgs/Reset</a> 重置<em>所有</em>无人机</p></li></ul></li><li><p>Parameters:<a target="_blank" rel="noopener" href="https://microsoft.github.io/AirSim/airsim_ros_pkgs/#parameters">#</a></p><ul><li><p><code>/airsim_node/world_frame_id</code> [string] Set in: <code>$(airsim_ros_pkgs)/launch/airsim_node.launch</code> 默认值：world_ned 设置为 &quot;world_enu &quot;可自动切换到 ENU 框架</p></li><li><p><code>/airsim_node/odom_frame_id</code> [string] Set in: <code>$(airsim_ros_pkgs)/launch/airsim_node.launch</code> 默认值： odom_local_ned 如果将 world_frame_id 设置为 “world_enu”，则默认 odom 名称将改为 “odom_local_enu”</p></li><li><p><code>/airsim_node/coordinate_system_enu</code> [boolean] Set in: <code>$(airsim_ros_pkgs)/launch/airsim_node.launch</code> 默认值：false 如果将 world_frame_id 设置为 “world_enu”，该设置将默认为 true</p></li><li><p><code>/airsim_node/update_airsim_control_every_n_sec</code> [double] Set in: <code>$(airsim_ros_pkgs)/launch/airsim_node.launch</code> 默认值：0.01 秒。计时器回调频率，用于从 airsim 更新无人机 Odom 和状态，以及发送控制命令。当前 RPClib 与虚幻引擎的接口最大频率为 50 赫兹。ROS 中的定时器回调以最大速率运行，因此最好不要触及此参数</p></li><li><p><code>/airsim_node/update_airsim_img_response_every_n_sec</code> [double] Set in: <code>$(airsim_ros_pkgs)/launch/airsim_node.launch</code> 默认值：0.01 秒。从 airsim 中所有摄像机接收图像的定时器回调频率。速度取决于请求图像的数量和分辨率。ROS 中的定时回调以最大可能的速度运行，因此最好不要触及此参数</p></li><li><p><code>/airsim_node/publish_clock</code> [double] Set in: <code>$(airsim_ros_pkgs)/launch/airsim_node.launch</code> 默认值：false 设置为 true 时，将发布 ros /clock 主题</p></li></ul></li></ul></blockquote><blockquote><p><strong>注：启动PX4连接成功后，可以通过QGC地面站一键起飞无人机</strong></p><p><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://s2.loli.net/2024/06/12/Lg1T7aX4spxC2ze.gif" alt="gif3"></p></blockquote></article><div class="post-copyright"><div class="copyright-cc-box"><i class="anzhiyufont anzhiyu-icon-copyright"></i></div><div class="post-copyright__author_box"><a class="post-copyright__author_img" href="/" title="头像"><img class="post-copyright__author_img_back" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/head.jpg" title="头像" alt="头像"><img class="post-copyright__author_img_front" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/head.jpg" title="头像" alt="头像"></a><div class="post-copyright__author_name">MGodmonkey</div><div class="post-copyright__author_desc">不在沉默中沉沦</div></div><div class="post-copyright__post__info"><a class="post-copyright__original" title="该文章为原创文章，注意版权协议" href="https://www.mgodmonkey.cn/posts/982cb875.html">原创</a><a class="post-copyright-title"><span onclick='rm.copyPageUrl("https://www.mgodmonkey.cn/posts/982cb875.html")'>从0制作自主空中机器人-5-Airsim-PX4仿真环境搭建</span></a></div><div class="post-tools" id="post-tools"><div class="post-tools-left"><div class="rewardLeftButton"><div class="post-reward" onclick="anzhiyu.addRewardMask()"><div class="reward-button button--animated" title="赞赏作者"><i class="anzhiyufont anzhiyu-icon-hand-heart-fill"></i>打赏作者</div><div class="reward-main"><div class="reward-all"><span class="reward-title">感谢你赐予我前进的力量</span><ul class="reward-group"><li class="reward-item"><a href="https://mybog.s3.bitiful.net/imgs/reward_wechat.png" target="_blank"><img class="post-qr-code-img" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/reward_wechat.png" alt="微信"></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="https://mybog.s3.bitiful.net/imgs/reward_alipay.png" target="_blank"><img class="post-qr-code-img" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/reward_alipay.png" alt="支付宝"></a><div class="post-qr-code-desc">支付宝</div></li></ul><a class="reward-main-btn" href="/about/#about-reward" target="_blank"><div class="reward-text">赞赏者名单</div><div class="reward-dec">因为你们的支持让我意识到写文章的价值🙏</div></a></div></div></div><div id="quit-box" onclick="anzhiyu.removeRewardMask()" style="display:none"></div></div><div class="shareRight"><div class="share-link mobile"><div class="share-qrcode"><div class="share-button" title="使用手机访问这篇文章"><i class="anzhiyufont anzhiyu-icon-qrcode"></i></div><div class="share-main"><div class="share-main-all"><div id="qrcode" title="https://www.mgodmonkey.cn/posts/982cb875.html"></div><div class="reward-dec">使用手机访问这篇文章</div></div></div></div></div><div class="share-link weibo"><a class="share-button" target="_blank" href="https://service.weibo.com/share/share.php?title=从0制作自主空中机器人-5-Airsim-PX4仿真环境搭建&amp;url=https://www.mgodmonkey.cn/posts/982cb875.html&amp;pic=https://mybog.s3.bitiful.net/imgs/cover/cover_23.webp?_r_=aec10139-1087-2595-464e-c9d9570c297b" rel="external nofollow noreferrer noopener"><i class="anzhiyufont anzhiyu-icon-weibo"></i></a></div><script>function copyCurrentPageUrl(){var e=window.location.href,t=document.createElement("input");t.setAttribute("value",e),document.body.appendChild(t),t.select(),t.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(t)}</script><div class="share-link copyurl"><div class="share-button" id="post-share-url" title="复制链接" onclick="copyCurrentPageUrl()"><i class="anzhiyufont anzhiyu-icon-link"></i></div></div></div></div></div><div class="post-copyright__notice"><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://www.mgodmonkey.cn" target="_blank">MGodmonkeyの世界</a>！</span></div></div><div class="post-tools-right"><div class="tag_share"><div class="post-meta__box"><div class="post-meta__box__tag-list"><a class="post-meta__box__tags" href="/tags/ros/"><span class="tags-punctuation"><i class="anzhiyufont anzhiyu-icon-tag"></i></span> ros<span class="tagsPageCount">21</span></a><a class="post-meta__box__tags" href="/tags/%E6%97%A0%E4%BA%BA%E6%9C%BA/"><span class="tags-punctuation"><i class="anzhiyufont anzhiyu-icon-tag"></i></span> 无人机<span class="tagsPageCount">9</span></a><a class="post-meta__box__tags" href="/tags/%E4%BB%BF%E7%9C%9F/"><span class="tags-punctuation"><i class="anzhiyufont anzhiyu-icon-tag"></i></span> 仿真<span class="tagsPageCount">1</span></a></div></div></div><div class="post_share"><div class="social-share" data-image="https://mybog.s3.bitiful.net/imgs/cover/cover_23.webp?_r_=aec10139-1087-2595-464e-c9d9570c297b" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://lib.baomitu.com/social-share.js/1.0.16/css/share.min.css" media="print" onload='this.media="all"'><script src="https://lib.baomitu.com/social-share.js/1.0.16/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-full"><a href="/posts/64c6093c.html"><img class="prev-cover" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/cover/cover_8.webp?_r_=b330a536-2c57-151e-bdc1-1230a682fe0b" onerror='onerror=null,src="/img/404.jpg"' alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">香橙派Aipro初体验</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="anzhiyufont anzhiyu-icon-thumbs-up fa-fw" style="font-size:1.5rem;margin-right:4px"></i><span>喜欢这篇文章的人也看了</span></div><div class="relatedPosts-list"><div><a href="/posts/2c607ad2.html" title="CERLAB无人机自主框架：动态目标检测与跟踪"><img class="cover" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/cover/cover_7.webp?_r_=0fb1eff9-7ecc-ebd0-88a5-3cac919450f8" alt="cover"><div class="content is-center"><div class="date"><i class="anzhiyufont anzhiyu-icon-calendar-days fa-fw"></i> 2024-04-09</div><div class="title">CERLAB无人机自主框架：动态目标检测与跟踪</div></div></a></div><div><a href="/posts/349e2e18.html" title="CERLAB无人机自主框架：环境搭建"><img class="cover" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/JaEtOo8VKfpsh5M.webp?_r_=d4a584db-f39f-5863-c23e-51d9f43544f5" alt="cover"><div class="content is-center"><div class="date"><i class="anzhiyufont anzhiyu-icon-calendar-days fa-fw"></i> 2024-03-26</div><div class="title">CERLAB无人机自主框架：环境搭建</div></div></a></div><div><a href="/posts/282d4d3d.html" title="无人机基于NOKOV动捕系统获取位置数据"><img class="cover" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/cover/cover_19.webp?_r_=913028e8-6666-8202-0d0f-9fb019eec2b5" alt="cover"><div class="content is-center"><div class="date"><i class="anzhiyufont anzhiyu-icon-calendar-days fa-fw"></i> 2023-08-15</div><div class="title">无人机基于NOKOV动捕系统获取位置数据</div></div></a></div><div><a href="/posts/cfe889db.html" title="从0制作自主空中机器人-4-【PX4与Gazebo入门】"><img class="cover" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/cover/cover_7.webp?_r_=c257f0b9-560e-c630-3447-78a354b61141" alt="cover"><div class="content is-center"><div class="date"><i class="anzhiyufont anzhiyu-icon-calendar-days fa-fw"></i> 2023-08-11</div><div class="title">从0制作自主空中机器人-4-【PX4与Gazebo入门】</div></div></a></div><div><a href="/posts/39efaa44.html" title="从0制作自主空中机器人-2-2【无人机硬件选型-PX4篇】"><img class="cover" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/cover/cover_13.webp?_r_=a43989e6-9fe1-b5dd-60be-ac8780ab6668" alt="cover"><div class="content is-center"><div class="date"><i class="anzhiyufont anzhiyu-icon-calendar-days fa-fw"></i> 2023-08-10</div><div class="title">从0制作自主空中机器人-2-2【无人机硬件选型-PX4篇】</div></div></a></div><div><a href="/posts/eb82f52e.html" title="从0制作自主空中机器人-3-【环境与常用软件安装】"><img class="cover" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/cover/cover_12.webp?_r_=d1bb54fd-945d-7dfc-6ae2-966719581500" alt="cover"><div class="content is-center"><div class="date"><i class="anzhiyufont anzhiyu-icon-calendar-days fa-fw"></i> 2023-08-08</div><div class="title">从0制作自主空中机器人-3-【环境与常用软件安装】</div></div></a></div></div></div><hr><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="anzhiyufont anzhiyu-icon-comments"></i> <span>评论</span></div><div class="comment-randomInfo"><a onclick="anzhiyu.addRandomCommentInfo()" href="javascript:void(0)">匿名评论</a><a href="/privacy" style="margin-left:4px">隐私政策</a></div><div class="comment-tips" id="comment-tips"><span>✅ 你无需删除空行，直接评论以获取最佳展示效果</span></div></div><div class="comment-wrap"><div><div id="twikoo-wrap"></div></div></div></div><div class="comment-barrage"></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-content"><div class="author-info__sayhi" id="author-info__sayhi" onclick="anzhiyu.changeSayHelloText()"></div><div class="author-info-avatar"><img class="avatar-img" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/head.jpg" onerror='this.onerror=null,this.src="/img/404.webp"' alt="avatar"><div class="author-status"><img class="g-status" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://bu.dusays.com/2023/08/24/64e6ce9c507bb.png" alt="status"></div></div><div class="author-info__description"><div style="line-height:1.38;margin:.1rem 0;text-align:justify;color:rgba(255,255,255,.8)">这里是我的<b style="color:#fff">科研日记本</b>和<b style="color:#fff">学习记录本</b>，目前处于研1阶段，主攻领域为<b style="color:#fff">空中机器人</b>，因此你将会在这看到大量关于<b style="color:#fff">ROS</b>、<b style="color:#fff">无人机</b>、<b style="color:#fff">算法</b>等教程</div><div style="line-height:1.38;margin:.3rem 0;text-align:justify;color:rgba(255,255,255,.8)">希望你能在这里学习到有用的<b style="color:#fff">知识</b>，可以的话可以<b style="color:#fff">收藏本网站😘</b>。</div></div><div class="author-info__bottom-group"><a class="author-info__bottom-group-left" href="/"><h1 class="author-info__name">MGodmonkey</h1><div class="author-info__desc">不在沉默中沉沦</div></a><div class="card-info-social-icons is-center"><a class="social-icon faa-parent animated-hover" href="https://github.com/MGod-monkey" target="_blank" title="Github"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-github"></use></svg></a><a class="social-icon faa-parent animated-hover" href="https://gitee.com/mgod_wu" target="_blank" title="Gitee"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-gitee"></use></svg></a><a class="social-icon faa-parent animated-hover" href="https://blog.csdn.net/qq_45516773" target="_blank" title="CSDN"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-csdn"></use></svg></a></div></div></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="anzhiyufont anzhiyu-icon-bullhorn anzhiyu-shake"></i><span>公告</span></div><div class="announcement_content"><center>主域名：<br><del><a target="_blank" rel="noopener" href="https://www.mgodmonkey.love"><b><font color="#5ea6e5">mgodmonkey.love(太贵续费不起)</font></b></a></del><br><a href="https://www.mgodmonkey.cn"><b><font color="#5ee5e0">mgodmonkey.cn</font></b></a><br>备用域名：<br><a target="_blank" rel="noopener" href="https://mgod-monkey.github.io/"><b><font color="#5ea6e5">mgodmonkey.github.io</font></b></a><br><a target="_blank" rel="noopener" href="https://mgodmonkey.zeabur.app/"><b><font color="#5ea6e5">mgodmonkey.zeabur.app</font></b></a><br><a href="mailto:mgod_monkey@qq.com">📬：<font color="#a591e0">mgod_monkey@qq.com</font></a></center></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="anzhiyufont anzhiyu-icon-bars"></i><span>文章目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-AirSim-Windows%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE"><span class="toc-text">1.AirSim-Windows环境配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-1Build-Airsim"><span class="toc-text">1.1Build Airsim</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#1-2%E8%87%AA%E5%AE%9A%E4%B9%89%E5%9C%BA%E6%99%AF"><span class="toc-text">1.2自定义场景</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-WSL2%E6%88%96%E8%80%85VM%E8%99%9A%E6%8B%9F%E6%9C%BA%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE"><span class="toc-text">2. WSL2或者VM虚拟机环境配置</span></a></li></ol></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div id="footer_deal"><a class="deal_link" href="mailto:mgod_monkey@qq.com" title="email"><i class="anzhiyufont anzhiyufont anzhiyu-icon-envelope"></i></a><a class="deal_link" target="_blank" rel="noopener" href="https://www.facebook.com/profile.php?id=100093287072649&amp;sk=about" title="facebook"><i class="anzhiyufont anzhiyufont anzhiyu-icon-facebook1"></i></a><img class="footer_mini_logo" title="返回顶部" alt="返回顶部" onclick="anzhiyu.scrollToDest(0,500)" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/xx.webp" size="50px"><a class="deal_link" target="_blank" rel="noopener" href="https://github.com/MGod-monkey" title="Github"><i class="anzhiyufont anzhiyufont anzhiyu-icon-github"></i></a><a class="deal_link" target="_blank" rel="noopener" href="https://v.douyin.com/UaF6wSA/" title="抖音"><i class="anzhiyufont anzhiyufont anzhiyu-icon-tiktok"></i></a></div><div id="anzhiyu-footer"><div class="footer-group"><div class="footer-title">服务</div><div class="footer-links"><a class="footer-item" title="51la统计" target="_blank" rel="noopener" href="https://v6.51.la/">51la统计</a><a class="footer-item" title="十年之约" target="_blank" rel="noopener" href="https://www.foreverblog.cn/">十年之约</a><a class="footer-item" title="开往" target="_blank" rel="noopener" href="https://github.com/travellings-link/travellings">开往</a></div></div><div class="footer-group"><div class="footer-title">导航</div><div class="footer-links"><a class="footer-item" title="即刻短文" href="/personal/essay/">即刻短文</a><a class="footer-item" title="友链文章" href="/fcircle/">友链文章</a><a class="footer-item" title="留言板" href="/comments/">留言板</a></div></div><div class="footer-group"><div class="footer-title">协议</div><div class="footer-links"><a class="footer-item" title="隐私协议" href="/privacy/">隐私协议</a><a class="footer-item" title="Cookies" href="/cookies/">Cookies</a><a class="footer-item" title="版权协议" href="/copyright/">版权协议</a></div></div><div class="footer-group"><div class="footer-title-group"><div class="footer-title">友链</div><a class="random-friends-btn" id="footer-random-friends-btn" href="javascript:addFriendLinksInFooter();" title="换一批友情链接"><i class="anzhiyufont anzhiyu-icon-arrow-rotate-right"></i></a></div><div class="footer-links" id="friend-links-in-footer"></div></div></div><div id="workboard"><div id="runtimeTextTip"></div></div><p id="ghbdages"><a class="github-badge" target="_blank" href="https://hexo.io/" style="margin-inline:5px" data-title="博客框架Hexo_v6.4.3" title="博客框架Hexo_v6.4.3"><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://sourcebucket.s3.bitiful.net/badge/Frame-Hexo-blue.svg" alt="博客框架Hexo_v6.4.3"></a><a class="github-badge" target="_blank" href="https://docs.anheyu.com/" style="margin-inline:5px" data-title="主题版本Anzhiyu_v1.5.0" title="主题版本Anzhiyu_v1.5.0"><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://npm.elemecdn.com/anzhiyu-theme-static@1.0.9/img/Theme-AnZhiYu-2E67D3.svg" alt="主题版本Anzhiyu_v1.5.0"></a><a class="github-badge" target="_blank" href="https://vercel.com/" style="margin-inline:5px" data-title="本站采用多线部署，主线路托管于Vercel" title="本站采用多线部署，主线路托管于Vercel"><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://sourcebucket.s3.bitiful.net/badge/Hosted-Vercel-brightgreen.svg" alt="本站采用多线部署，主线路托管于Vercel"></a><a class="github-badge" target="_blank" href="https://github.com/" style="margin-inline:5px" data-title="本站项目由Github托管" title="本站项目由Github托管"><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://npm.elemecdn.com/anzhiyu-blog@2.1.5/img/badge/Source-Github.svg" alt="本站项目由Github托管"></a><a class="github-badge" target="_blank" href="https://beian.miit.gov.cn/" style="margin-inline:5px" data-title="本站已完成备案，桂ICP备-2023001814号" title="本站已完成备案，桂ICP备-2023001814号"><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/桂ICP备-2023001814号-1.svg" alt="本站已完成备案，桂ICP备-2023001814号"></a><a class="github-badge" target="_blank" href="https://icp.gov.moe/?keyword=20248520" style="margin-inline:5px" data-title="本站已加入萌ICP豪华套餐，萌ICP备20248520号" title="本站已加入萌ICP豪华套餐，萌ICP备20248520号"><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/mengICP_20248520.svg" alt="本站已加入萌ICP豪华套餐，萌ICP备20248520号"></a><a class="github-badge" target="_blank" href="http://creativecommons.org/licenses/by-nc-sa/4.0/" style="margin-inline:5px" data-title="本站采用知识共享署名-非商业性使用-相同方式共享4.0国际许可协议进行许可" title="本站采用知识共享署名-非商业性使用-相同方式共享4.0国际许可协议进行许可"><img src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://npm.elemecdn.com/anzhiyu-blog@2.2.0/img/badge/Copyright-BY-NC-SA.svg" alt="本站采用知识共享署名-非商业性使用-相同方式共享4.0国际许可协议进行许可"></a></p></div><div id="footer-bar"><div class="footer-bar-links"><div class="footer-bar-left"><div id="footer-bar-tips"><div class="copyright">&copy;2023 - 2024 By <a class="footer-bar-link" href="/" title="MGodmonkey" target="_blank">MGodmonkey</a></div></div><div id="footer-type-tips"></div><div class="js-pjax"><script>function subtitleType(){fetch("https://v1.hitokoto.cn").then((t=>t.json())).then((t=>{{const e="出自 "+t.from,p=[];p.unshift(t.hitokoto,e),window.typed=new Typed("#footer-type-tips",{strings:p,startDelay:300,typeSpeed:150,loop:!0,backSpeed:50})}}))}"function"==typeof Typed?subtitleType():getScript("https://cdn.cbd.int/typed.js@2.1.0/dist/typed.umd.js").then(subtitleType)</script></div></div><div class="footer-bar-right"><a class="footer-bar-link" target="_blank" rel="noopener" href="https://beian.miit.gov.cn/" title="桂ICP备-2023001814号">桂ICP备-2023001814号</a><a class="footer-bar-link cc" href="/copyright" title="cc协议"><i class="anzhiyufont anzhiyu-icon-copyright-line"></i><i class="anzhiyufont anzhiyu-icon-creative-commons-by-line"></i><i class="anzhiyufont anzhiyu-icon-creative-commons-nc-line"></i><i class="anzhiyufont anzhiyu-icon-creative-commons-nd-line"></i></a></div></div></div></footer></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="sidebar-site-data site-data is-center"><a href="/archives/" title="archive"><div class="headline">文章</div><div class="length-num">32</div></a><a href="/tags/" title="tag"><div class="headline">标签</div><div class="length-num">18</div></a><a href="/categories/" title="category"><div class="headline">分类</div><div class="length-num">13</div></a></div><span class="sidebar-menu-item-title">功能</span><div class="sidebar-menu-item"><a class="darkmode_switchbutton menu-child" href="javascript:void(0);" title="显示模式"><i class="anzhiyufont anzhiyu-icon-circle-half-stroke"></i><span>显示模式</span></a></div><div class="back-menu-list-groups"><div class="back-menu-list-group"><div class="back-menu-list-title">网页</div><div class="back-menu-list"><a class="back-menu-item" href="https://www.mgodmonkey.cn/" title="博客"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/favicon.ico" alt="博客"><span class="back-menu-item-text">博客</span></a></div></div><div class="back-menu-list-group"><div class="back-menu-list-title">AI项目</div><div class="back-menu-list"><a class="back-menu-item" target="_blank" rel="noopener" href="https://chat.mgodmonkey.cn/" title="ChatGPT"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/圣女果.svg" alt="ChatGPT"><span class="back-menu-item-text">ChatGPT</span></a><a class="back-menu-item" target="_blank" rel="noopener" href="https://newchat.mgodmonkey.cn/" title="NewChatGPT"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/苹果.svg" alt="NewChatGPT"><span class="back-menu-item-text">NewChatGPT</span></a><a class="back-menu-item" target="_blank" rel="noopener" href="https://autogpt.mgodmonkey.cn/" title="AutoGPT"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/火龙果.svg" alt="AutoGPT"><span class="back-menu-item-text">AutoGPT</span></a><a class="back-menu-item" target="_blank" rel="noopener" href="https://academic.chatwithpaper.org/" title="AcademicGPT"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/石榴.svg" alt="AcademicGPT"><span class="back-menu-item-text">AcademicGPT</span></a><a class="back-menu-item" target="_blank" rel="noopener" href="https://chatwithpaper.org/" title="Chatpaper"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/芒果.svg" alt="Chatpaper"><span class="back-menu-item-text">Chatpaper</span></a></div></div><div class="back-menu-list-group"><div class="back-menu-list-title">其他</div><div class="back-menu-list"><a class="back-menu-item" target="_blank" rel="noopener" href="https://memos.mgodmonkey.cn/" title="Memos"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/圣女果.svg" alt="Memos"><span class="back-menu-item-text">Memos</span></a><a class="back-menu-item" target="_blank" rel="noopener" href="https://github.com/MGod-monkey/Must_Pass_Experiment_of_TY" title="必过通原"><img class="back-menu-item-icon" src="" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/苹果.svg" alt="必过通原"><span class="back-menu-item-text">必过通原</span></a></div></div></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span>文章</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/archives/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu-kele"></use></svg> <span>归档</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/tags/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu-zhaji"></use></svg> <span>标签</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/categories/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu-denglong"></use></svg> <span>分类</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span>休闲</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" target="_blank" rel="noopener" href="https://music.mgodmonkey.cn"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu-erji"></use></svg> <span>音乐</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/life/bangumis/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu-kafei"></use></svg> <span>番剧</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/life/air-conditioner"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-chonglang"></use></svg> <span>空调</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span>社交</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/comments/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon--chat"></use></svg> <span>留言板</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/album/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-zhaopian_1"></use></svg> <span>相册集</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/album/MyFavoriteBaby/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xingsu"></use></svg> <span>大陆养虾</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/social/link/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu_shu"></use></svg> <span>加入友链</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><span>个人</span></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/personal/essay/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu_qizhi"></use></svg> <span>说说</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/personal/task_list/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu_xiaoya"></use></svg> <span>清单</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/personal/equipment/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu_xigua"></use></svg> <span>装备</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/personal/about/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangsu_aixin"></use></svg> <span>关于</span></a></li></ul></div></div><span class="sidebar-menu-item-title">标签</span><div class="card-tags"><div class="item-headline"></div><div class="card-tag-cloud"><a href="/tags/Arduino/" style="font-size:.88rem;color:#c1b22b">Arduino<sup>1</sup></a><a href="/tags/ESP32/" style="font-size:.88rem;color:#92b15c">ESP32<sup>1</sup></a><a href="/tags/Markdown/" style="font-size:.88rem;color:#a8369c">Markdown<sup>1</sup></a><a href="/tags/SLAM/" style="font-size:.88rem;color:#8d6e37">SLAM<sup>1</sup></a><a href="/tags/linux/" style="font-size:.88rem;color:#6a4fc3">linux<sup>1</sup></a><a href="/tags/lvgl/" style="font-size:.88rem;color:#027428">lvgl<sup>1</sup></a><a href="/tags/pyqt5/" style="font-size:.88rem;color:#c42e7e">pyqt5<sup>5</sup></a><a href="/tags/ros/" style="font-size:.88rem;color:#766266">ros<sup>21</sup></a><a href="/tags/wsl/" style="font-size:.88rem;color:#4e522c">wsl<sup>1</sup></a><a href="/tags/yolo/" style="font-size:.88rem;color:#6c1688">yolo<sup>1</sup></a><a href="/tags/%E4%BA%8B%E4%BB%B6%E7%9B%B8%E6%9C%BA/" style="font-size:.88rem;color:#100984">事件相机<sup>1</sup></a><a href="/tags/%E4%BB%BF%E7%9C%9F/" style="font-size:.88rem;color:#5d128b">仿真<sup>1</sup></a><a href="/tags/%E5%A4%96%E6%8C%82%E6%A0%87%E7%AD%BE/" style="font-size:.88rem;color:#01584a">外挂标签<sup>1</sup></a><a href="/tags/%E6%97%A0%E4%BA%BA%E6%9C%BA/" style="font-size:.88rem;color:#4dac89">无人机<sup>9</sup></a><a href="/tags/%E6%B5%8B%E8%AF%84/" style="font-size:.88rem;color:#861e41">测评<sup>1</sup></a><a href="/tags/%E7%AE%97%E6%B3%95/" style="font-size:.88rem;color:#a39674">算法<sup>3</sup></a><a href="/tags/%E9%97%AE%E9%A2%98%E5%A4%A7%E5%85%A8/" style="font-size:.88rem;color:#3d7831">问题大全<sup>1</sup></a><a href="/tags/%E9%A1%B9%E7%9B%AE%E5%88%86%E4%BA%AB/" style="font-size:.88rem;color:#0a35ad">项目分享<sup>1</sup></a></div></div><hr></div></div><div id="keyboard-tips"><div class="keyboardTitle">博客快捷键</div><div class="keybordList"><div class="keybordItem"><div class="keyGroup"><div class="key">shift K</div></div><div class="keyContent"><div class="content">关闭快捷键功能</div></div></div><div class="keybordItem"><div class="keyGroup"><div class="key">shift A</div></div><div class="keyContent"><div class="content">打开/关闭中控台</div></div></div><div class="keybordItem"><div class="keyGroup"><div class="key">shift M</div></div><div class="keyContent"><div class="content">播放/暂停音乐</div></div></div><div class="keybordItem"><div class="keyGroup"><div class="key">shift D</div></div><div class="keyContent"><div class="content">深色/浅色显示模式</div></div></div><div class="keybordItem"><div class="keyGroup"><div class="key">shift S</div></div><div class="keyContent"><div class="content">站内搜索</div></div></div><div class="keybordItem"><div class="keyGroup"><div class="key">shift R</div></div><div class="keyContent"><div class="content">随机访问</div></div></div><div class="keybordItem"><div class="keyGroup"><div class="key">shift H</div></div><div class="keyContent"><div class="content">返回首页</div></div></div><div class="keybordItem"><div class="keyGroup"><div class="key">shift F</div></div><div class="keyContent"><div class="content">友链鱼塘</div></div></div><div class="keybordItem"><div class="keyGroup"><div class="key">shift L</div></div><div class="keyContent"><div class="content">友链页面</div></div></div><div class="keybordItem"><div class="keyGroup"><div class="key">shift P</div></div><div class="keyContent"><div class="content">关于本站</div></div></div><div class="keybordItem"><div class="keyGroup"><div class="key">shift I</div></div><div class="keyContent"><div class="content">原版/本站右键菜单</div></div></div></div></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="anzhiyufont anzhiyu-icon-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="anzhiyufont anzhiyu-icon-circle-half-stroke"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="anzhiyufont anzhiyu-icon-arrows-left-right"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="anzhiyufont anzhiyu-icon-gear"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="anzhiyufont anzhiyu-icon-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="anzhiyufont anzhiyu-icon-comments"></i></a><a id="switch-commentBarrage" href="javascript:anzhiyu.switchCommentBarrage();" title="开关弹幕"><i class="anzhiyufont anzhiyu-icon-danmu"></i></a><button id="go-up" type="button" title="回到顶部"><i class="anzhiyufont anzhiyu-icon-arrow-up"></i></button></div></div><div id="nav-music"><a id="nav-music-hoverTips" onclick="anzhiyu.musicToggle()" accesskey="m">播放音乐</a><div id="console-music-bg"></div><meting-js id="572504216" server="netease" type="playlist" mutex="true" preload="none" theme="var(--anzhiyu-main)" data-lrctype="0" order="random" volume="0.7"></meting-js></div><div id="algolia-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><button class="search-close-button"><i class="anzhiyufont anzhiyu-icon-xmark"></i></button></nav><div class="search-wrap"><div id="algolia-search-input"></div><hr><div id="algolia-search-results"><div id="algolia-hits"></div><div id="algolia-pagination"></div><div id="algolia-info"><div class="algolia-stats"></div><div class="algolia-poweredBy"></div></div></div></div></div><div id="search-mask"></div></div><div id="rightMenu"><div class="rightMenu-group rightMenu-small"><div class="rightMenu-item" id="menu-backward"><i class="anzhiyufont anzhiyu-icon-arrow-left"></i></div><div class="rightMenu-item" id="menu-forward"><i class="anzhiyufont anzhiyu-icon-arrow-right"></i></div><div class="rightMenu-item" id="menu-refresh"><i class="anzhiyufont anzhiyu-icon-arrow-rotate-right" style="font-size:1rem"></i></div><div class="rightMenu-item" id="menu-top"><i class="anzhiyufont anzhiyu-icon-arrow-up"></i></div></div><div class="rightMenu-group rightMenu-line rightMenuPlugin"><div class="rightMenu-item" id="menu-copytext"><i class="anzhiyufont anzhiyu-icon-copy"></i><span>复制选中文本</span></div><div class="rightMenu-item" id="menu-pastetext"><i class="anzhiyufont anzhiyu-icon-paste"></i><span>粘贴文本</span></div><a class="rightMenu-item" id="menu-commenttext"><i class="anzhiyufont anzhiyu-icon-comment-medical"></i><span>引用到评论</span></a><div class="rightMenu-item" id="menu-newwindow"><i class="anzhiyufont anzhiyu-icon-window-restore"></i><span>新窗口打开</span></div><div class="rightMenu-item" id="menu-copylink"><i class="anzhiyufont anzhiyu-icon-link"></i><span>复制链接地址</span></div><div class="rightMenu-item" id="menu-copyimg"><i class="anzhiyufont anzhiyu-icon-images"></i><span>复制此图片</span></div><div class="rightMenu-item" id="menu-downloadimg"><i class="anzhiyufont anzhiyu-icon-download"></i><span>下载此图片</span></div><div class="rightMenu-item" id="menu-newwindowimg"><i class="anzhiyufont anzhiyu-icon-window-restore"></i><span>新窗口打开图片</span></div><div class="rightMenu-item" id="menu-search"><i class="anzhiyufont anzhiyu-icon-magnifying-glass"></i><span>站内搜索</span></div><div class="rightMenu-item" id="menu-searchBaidu"><i class="anzhiyufont anzhiyu-icon-magnifying-glass"></i><span>百度搜索</span></div><div class="rightMenu-item" id="menu-music-toggle"><i class="anzhiyufont anzhiyu-icon-play"></i><span>播放音乐</span></div><div class="rightMenu-item" id="menu-music-back"><i class="anzhiyufont anzhiyu-icon-backward"></i><span>切换到上一首</span></div><div class="rightMenu-item" id="menu-music-forward"><i class="anzhiyufont anzhiyu-icon-forward"></i><span>切换到下一首</span></div><div class="rightMenu-item" id="menu-music-playlist" onclick="window.open(&quot;https://music.mgodmonkey.cn&quot;, &quot;_blank&quot;);" style="display:none"><i class="anzhiyufont anzhiyu-icon-radio"></i><span>查看所有歌曲</span></div><div class="rightMenu-item" id="menu-music-copyMusicName"><i class="anzhiyufont anzhiyu-icon-copy"></i><span>复制歌名</span></div></div><div class="rightMenu-group rightMenu-line rightMenuOther"><a class="rightMenu-item menu-link" id="menu-randomPost"><i class="anzhiyufont anzhiyu-icon-shuffle"></i><span>随便逛逛</span></a><a class="rightMenu-item menu-link" href="/categories/"><i class="anzhiyufont anzhiyu-icon-cube"></i><span>博客分类</span></a><a class="rightMenu-item menu-link" href="/tags/"><i class="anzhiyufont anzhiyu-icon-tags"></i><span>文章标签</span></a></div><div class="rightMenu-group rightMenu-line rightMenuOther"><a class="rightMenu-item" id="menu-copy" href="javascript:void(0);"><i class="anzhiyufont anzhiyu-icon-copy"></i><span>复制地址</span></a><a class="rightMenu-item" id="menu-commentBarrage" href="javascript:void(0);"><i class="anzhiyufont anzhiyu-icon-message"></i><span class="menu-commentBarrage-text">关闭热评</span></a><a class="rightMenu-item" id="menu-darkmode" href="javascript:void(0);"><i class="anzhiyufont anzhiyu-icon-circle-half-stroke"></i><span class="menu-darkmode-text">深色模式</span></a><a class="rightMenu-item" id="menu-translate" href="javascript:void(0);"><i class="anzhiyufont anzhiyu-icon-language"></i><span>轉為繁體</span></a></div></div><div id="rightmenu-mask"></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.cbd.int/@fancyapps/ui@5.0.28/dist/fancybox/fancybox.umd.js"></script><script src="https://cdn.cbd.int/instant.page@5.2.0/instantpage.js" type="module"></script><script src="https://cdn.cbd.int/vanilla-lazyload@17.8.5/dist/lazyload.iife.min.js"></script><script src="https://cdn.cbd.int/node-snackbar@0.1.16/dist/snackbar.min.js"></script><script>function panguFn(){"object"==typeof pangu?pangu.autoSpacingPage():getScript("https://cdn.cbd.int/pangu@4.0.7/dist/browser/pangu.min.js").then((()=>{pangu.autoSpacingPage()}))}function panguInit(){GLOBAL_CONFIG_SITE.isPost&&panguFn()}document.addEventListener("DOMContentLoaded",panguInit)</script><script>var meting_api="https://api.injahow.cn/meting/?server=:server&type=:type&id=:id&auth=:auth&r=:r"</script><canvas id="universe"></canvas><script async src="https://npm.elemecdn.com/anzhiyu-theme-static@1.0.0/dark/dark.js"></script><script>var HoldLog=console.log;console.log=function(){};let now1=new Date;queueMicrotask((()=>{const o=function(){HoldLog.apply(console,arguments)},n=new Date("03/18/2023 00:00:00");now1.setTime(now1.getTime()+250);const c=(now1-n)/1e3/60/60/24,e=["欢迎来访MGodmonkeyの世界!","心中有光万物皆是光，万物皆是迪迦！","\n        \n    ███╗   ███╗ ██████╗  ██████╗ ██████╗ ███╗   ███╗ ██████╗ ███╗   ██╗██╗  ██╗███████╗██╗   ██╗\n    ████╗ ████║██╔════╝ ██╔═══██╗██╔══██╗████╗ ████║██╔═══██╗████╗  ██║██║ ██╔╝██╔════╝╚██╗ ██╔╝\n    ██╔████╔██║██║  ███╗██║   ██║██║  ██║██╔████╔██║██║   ██║██╔██╗ ██║█████╔╝ █████╗   ╚████╔╝ \n    ██║╚██╔╝██║██║   ██║██║   ██║██║  ██║██║╚██╔╝██║██║   ██║██║╚██╗██║██╔═██╗ ██╔══╝    ╚██╔╝  \n    ██║ ╚═╝ ██║╚██████╔╝╚██████╔╝██████╔╝██║ ╚═╝ ██║╚██████╔╝██║ ╚████║██║  ██╗███████╗   ██║   \n    ╚═╝     ╚═╝ ╚═════╝  ╚═════╝ ╚═════╝ ╚═╝     ╚═╝ ╚═════╝ ╚═╝  ╚═══╝╚═╝  ╚═╝╚══════╝   ╚═╝    \n        \n        ","已上线",Math.floor(c),"天","©2023 By MGodmonkey 1.6.12"],t=["NCC2-036","调用前置摄像头拍照成功，识别为【小笨蛋】.","Photo captured: ","🤪"];setTimeout(o.bind(console,`\n%c${e[0]} %c ${e[1]} %c ${e[2]} %c${e[3]}%c ${e[4]}%c ${e[5]}\n\n%c ${e[6]}\n`,"color:#3b70fc","","color:#3b70fc","color:#3b70fc","","color:#3b70fc","")),setTimeout(o.bind(console,`%c ${t[0]} %c ${t[1]} %c \n${t[2]} %c\n${t[3]}\n`,"color:white; background-color:#4fd953","","",'background:url("https://npm.elemecdn.com/anzhiyu-blog@1.1.6/img/post/common/tinggge.gif") no-repeat;font-size:450%')),setTimeout(o.bind(console,"%c WELCOME %c 你好，小笨蛋.","color:white; background-color:#4f90d9","")),setTimeout(console.warn.bind(console,"%c ⚡ Powered by MGodmonkey %c 你正在访问 MGodmonkey 的博客.","color:white; background-color:#f0ad4e","")),setTimeout(o.bind(console,"%c W23-12 %c 你已打开控制台.","color:white; background-color:#4f90d9","")),setTimeout(console.warn.bind(console,"%c S013-782 %c 你现在正处于监控中.","color:white; background-color:#d9534f",""))}))</script><script async src="/anzhiyu/random.js"></script><script async>!function(){var t,e,n,r,a,o,i,l,h=new Date("03/18/2023 00:00:00"),u=new Date("02/13/2024 11:47:00"),g=new Date;setInterval((()=>{!function(){g=new Date,g.getHours();var f=(g-h)/1e3/60/60/24;t=Math.floor(f);var s=(g-h)/1e3/60/60-24*t;e=Math.floor(s),1==String(e).length&&(e="0"+e);var c=(g-h)/1e3/60-1440*t-60*e;n=Math.floor(c),1==String(n).length&&(n="0"+n);var d=(g-h)/1e3-86400*t-3600*e-60*n;r=Math.round(d),1==String(r).length&&(r="0"+r),g.getHours();var m=(g-u)/1e3/60/60/24;a=Math.floor(m);var v=(g-u)/1e3/60/60-24*a;o=Math.floor(v),1==String(o).length&&(o="0"+o);var y=(g-u)/1e3/60-1440*a-60*o;i=Math.floor(y),1==String(i).length&&(i="0"+i);var M=(g-u)/1e3-86400*a-3600*o-60*i;l=Math.round(M),1==String(l).length&&(l="0"+l)}(),function(){if(!document.getElementById("footer"))return;let h="";h=`恋爱进度条运行了 ${a} 天<span id='runtime'> ${o} 小时 ${i} 分 ${l} 秒 </span><i class='anzhiyufont anzhiyu-icon-heartbeat' style='color:pink'></i><br>本站居然运行了 ${t} 天<span id='runtime'> ${e} 小时 ${n} 分 ${r} 秒 </span><i class='anzhiyufont anzhiyu-icon-heartbeat' style='color:blue'></i>`,document.getElementById("runtimeTextTip")&&(document.getElementById("runtimeTextTip").innerHTML=h)}()}),1e3)}()</script><script src="https://cdn.cbd.int/algoliasearch@4.18.0/dist/algoliasearch-lite.umd.js"></script><script src="https://cdn.cbd.int/instantsearch.js@4.60.0/dist/instantsearch.production.min.js"></script><script src="/js/search/algolia.js"></script><div class="js-pjax"><script>(()=>{const o=()=>{"object"==typeof twikoo?setTimeout(t,0):getScript("https://cdn.cbd.int/twikoo@1.6.30/dist/twikoo.all.min.js").then(t)},t=()=>{twikoo.init(Object.assign({el:"#twikoo-wrap",envId:"https://twikoo.mgodmonkey.cn/",region:"",onCommentLoaded:()=>{anzhiyu.loadLightbox(document.querySelectorAll("#twikoo .tk-content img:not(.tk-owo-emotion)"))}},null))};anzhiyu.loadComment(document.getElementById("twikoo-wrap"),o)})()</script><input type="hidden" name="page-type" id="page-type" value="post"><script async src="/js/anzhiyu/comment_barrage.js"></script></div><script>window.addEventListener("load",(()=>{const e=e=>{let t="";if(e.length)for(let n=0;n<e.length;n++){t+="<div class='aside-list-item'>";{const a="data-lazy-src";t+=`<a href='${e[n].url}' class='thumbnail'><img ${a}='${e[n].avatar}' alt='${e[n].nick}'><div class='name'><span>${e[n].nick} </span></div></a>`}t+=`<div class='content'>\n        <a class='comment' href='${e[n].url}' title='${e[n].content}'>${e[n].content}</a>\n        <time datetime="${e[n].date}">${anzhiyu.diffDate(e[n].date,!0)}</time></div>\n        </div>`}else t+="没有评论";let n=document.querySelector("#card-newest-comments .aside-list");n&&(n.innerHTML=t),window.lazyLoadInstance&&window.lazyLoadInstance.update(),window.pjax&&window.pjax.refresh(n)},t=()=>{if(document.querySelector("#card-newest-comments .aside-list")){const t=saveToLocal.get("twikoo-newest-comments");t?e(JSON.parse(t)):(()=>{const t=()=>{twikoo.getRecentComments({envId:"https://twikoo.mgodmonkey.cn/",region:"",pageSize:6,includeReply:!0}).then((function(t){const n=t.map((e=>{return{content:(t=e.comment,""===t||(t=(t=(t=(t=t.replace(/<img.*?src="(.*?)"?[^\>]+>/gi,"[图片]")).replace(/<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi,"[链接]")).replace(/<pre><code>.*?<\/pre>/gi,"[代码]")).replace(/<[^>]+>/g,"")).length>150&&(t=t.substring(0,150)+"..."),t),avatar:e.avatar,nick:e.nick,url:e.url+"#"+e.id,date:new Date(e.created).toISOString()};var t}));saveToLocal.set("twikoo-newest-comments",JSON.stringify(n),10/1440),e(n)})).catch((function(e){document.querySelector("#card-newest-comments .aside-list").textContent="无法获取评论，请确认相关配置是否正确"}))};"object"==typeof twikoo?t():getScript("https://cdn.cbd.int/twikoo@1.6.30/dist/twikoo.all.min.js").then(t)})()}};t(),document.addEventListener("pjax:complete",t)}))</script><script async data-pjax src="https://npm.elemecdn.com/anzhiyu-theme-static@1.0.1/bubble/bubble.js"></script><script>var visitorMail="who@qq.com"</script><script async data-pjax src="https://cdn.cbd.int/anzhiyu-theme-static@1.0.0/waterfall/waterfall.js"></script><script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/qrcodejs/1.0.0/qrcode.min.js"></script><script src="/js/anzhiyu/right_click_menu.js"></script><link rel="stylesheet" href="https://cdn.cbd.int/anzhiyu-theme-static@1.1.9/icon/ali_iconfont_css.css"><script async src="https://at.alicdn.com/t/c/font_3960079_reowwynqtt7.js"></script><script async data-pjax src="/js/owo.js"></script><link rel="stylesheet" href="https://cdn.cbd.int/anzhiyu-theme-static@1.0.0/aplayer/APlayer.min.css" media="print" onload='this.media="all"'><script src="https://cdn.cbd.int/anzhiyu-blog-static@1.0.1/js/APlayer.min.js"></script><script src="https://npm.elemecdn.com/hexo-anzhiyu-music@1.0.2/assets/js/Meting2.min.js"></script><script src="https://lib.baomitu.com/pjax/0.2.8/pjax.min.js"></script><script>let pjaxSelectors=['meta[property="og:image"]','meta[property="og:title"]','meta[property="og:url"]','meta[property="og:type"]','meta[property="og:site_name"]','meta[property="og:description"]',"head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax"];var pjax=new Pjax({elements:'a:not([target="_blank"])',selectors:pjaxSelectors,cacheBust:!1,analytics:!1,scrollRestoration:!1});document.addEventListener("pjax:send",(function(){if(anzhiyu.removeGlobalFnEvent("pjax"),anzhiyu.removeGlobalFnEvent("themeChange"),document.getElementById("rightside").classList.remove("rightside-show"),window.aplayers)for(let e=0;e<window.aplayers.length;e++)window.aplayers[e].options.fixed||window.aplayers[e].destroy();"object"==typeof typed&&typed.destroy();const e=document.body.classList;e.contains("read-mode")&&e.remove("read-mode")})),document.addEventListener("pjax:complete",(function(){window.refreshFn(),document.querySelectorAll("script[data-pjax]").forEach((e=>{const t=document.createElement("script"),o=e.text||e.textContent||e.innerHTML||"";Array.from(e.attributes).forEach((e=>t.setAttribute(e.name,e.value))),t.appendChild(document.createTextNode(o)),e.parentNode.replaceChild(t,e)})),GLOBAL_CONFIG.islazyload&&window.lazyLoadInstance.update(),"function"==typeof panguInit&&panguInit(),"function"==typeof gtag&&gtag("config","",{page_path:window.location.pathname}),"object"==typeof _hmt&&_hmt.push(["_trackPageview",window.location.pathname]),"function"==typeof loadMeting&&document.getElementsByClassName("aplayer").length&&loadMeting(),"object"==typeof Prism&&Prism.highlightAll()})),document.addEventListener("pjax:error",(e=>{404===e.request.status&&pjax.loadUrl("/404.html")}))</script><script charset="UTF-8" src="https://cdn.cbd.int/anzhiyu-theme-static@1.1.5/accesskey/accesskey.js"></script></div><div id="popup-window"><div class="popup-window-title">通知</div><div class="popup-window-divider"></div><div class="popup-window-content"><div class="popup-tip">你好呀</div><div class="popup-link"><i class="anzhiyufont anzhiyu-icon-arrow-circle-right"></i></div></div></div><script data-pjax>function butterfly_swiper_injector_config(){var t=document.getElementById("recent-posts");console.log("已挂载butterfly_swiper"),t.insertAdjacentHTML("afterbegin",'<div class="recent-post-item" style="height: auto;width: 100%"><div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container"><div class="blog-slider__wrp swiper-wrapper" style="transition-duration: 0ms;"><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/2013454d.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/cover/cover_24.webp?_r_=29c82da3-de4f-1818-c6d4-8e86dc8f65bb" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-03-18</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/2013454d.html&quot;);" href="javascript:void(0);" alt="">Markdown语法与外挂标签写法汇总</a><div class="blog-slider__text">🥧本文汇总Markdown格式以及外挂标签在网页端的渲染效果，可作为文档进行查询</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/2013454d.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/934e71d1.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/cover/cover_31.webp?_r_=c21fe602-3554-f265-0e73-1524950a0e28" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-06-28</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/934e71d1.html&quot;);" href="javascript:void(0);" alt="">物体路径规划项目笔记</a><div class="blog-slider__text">再怎么看我也不知道怎么描述它的啦！</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/934e71d1.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/232d6cf1.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://bu.dusays.com/2023/10/02/651ad2e1606f4.png" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-06-23</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/232d6cf1.html&quot;);" href="javascript:void(0);" alt="">ROS资源汇总</a><div class="blog-slider__text">ROS常用资源汇总（从入门到入坟）</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/232d6cf1.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/f1cb77fb.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" onerror="this.onerror=null,this.src=&quot;/img/404.jpg&quot;" data-lazy-src="https://mybog.s3.bitiful.net/imgs/cover/cover_11.webp?_r_=c22c6364-0c20-490e-844b-7addff113b3b" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-06-29</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/f1cb77fb.html&quot;);" href="javascript:void(0);" alt="">ROS指令大全</a><div class="blog-slider__text">ROS常用指令大全（从入门到入坟）</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/f1cb77fb.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div></div><div class="blog-slider__pagination swiper-pagination-clickable swiper-pagination-bullets"></div></div></div>')}for(var elist="undefined".split(","),cpage=location.pathname,epage="/",flag=0,i=0;i<elist.length;i++)cpage.includes(elist[i])&&flag++;("all"===epage&&0==flag||epage===cpage)&&butterfly_swiper_injector_config()</script><script defer src="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.js"></script><script defer data-pjax src="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper_init.js"></script></body></html>